Hi,
Just had one more question. Is there a way to stop an Ansible playbook or
set of lines from executing if a variable matches a specific text? I saw
the Ansible conditionals documentation
<http://docs.ansible.com/ansible/latest/playbooks_conditionals.html>,
however it doesn't provide good examples on how to achieve this with a
"when:" statement nor does it tell where would be best to insert these
conditionals to prevent the specific lines from executing.
Here's my script
---
- hosts: all
become: yes
vars_prompt:
- name: "new_user"
prompt: "What is the name of the new user?"
when: new_user != "root"
tasks:
- name: some function
command: .....
- name: another function
command: .....
Do I tack the "when:" conditional on at the end of the vars_prompt: or
after each "command:" function below that to stop the commands from being
run?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/14426dbb-b0a6-4510-b7d3-e8d76961d3ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.