Running the playbook below and wondering whats the correct syntax so I can use a variable within the find statement below
This line is in question - when: p.stdout.find"{{('user')}}" != -1 This would be correct without a variable when: p.stdout.find('daniel') != -1 How do I do this with a variable? Playbook - hosts: localhost become: yes vars: user: daniel tasks: - name: Create a new user on the server user: name: "{{user}}" state: present - name: Check to ensure the user has been created shell: cat /etc/passwd | grep "{{user}}" register: p - debug: msg="The user {{user}} exists" when: p.stdout.find"{{('user')}}" != -1 - name: Create a file in the /opt folder called program1.sh command: touch program1.sh args: chdir: /opt creates: program1.sh -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/50d53110-db74-455e-b12e-cbc1cf639759%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.