Hi Abdul, You could remove the hosts from inventory.ym , else directly mention it in default hosts inventory file
Br Vinoth On Wed, 14 Nov 2018 at 8:26 AM, Abdul Rahim <[email protected]> wrote: > Thans Brian , > > It fails with following > > root@ansibile-launch:~/ansible/tasks/add-compute# ansible-playbook -i > inventory.yml add-compute.yml -vvvv > ansible-playbook 2.7.1 > config file = /etc/ansible/ansible.cfg > configured module search path = [u'/root/.ansible/plugins/modules', > u'/usr/share/ansible/plugins/modules'] > ansible python module location = /usr/lib/python2.7/dist-packages/ansible > executable location = /usr/bin/ansible-playbook > python version = 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 > 20160609] > Using /etc/ansible/ansible.cfg as config file > setting up inventory plugins > /root/ansible/tasks/add-compute/inventory.yml did not meet host_list > requirements, check plugin documentation if this is unexpected > /root/ansible/tasks/add-compute/inventory.yml did not meet script > requirements, check plugin documentation if this is unexpected > Parsed /root/ansible/tasks/add-compute/inventory.yml inventory source with > yaml plugin > ERROR! Syntax Error while loading YAML. > mapping values are not allowed in this context > > The error appears to have been in > '/root/ansible/tasks/add-compute/add-compute.yml': line 11, column 23, but > may > be elsewhere in the file depending on the exact syntax problem. > > The offending line appears to be: > > - name: Copy Test > ansible_user: "{{build_username}}" > ^ here > We could be wrong, but this one looks like it might be an issue with > missing quotes. Always quote template expression brackets when they > start a value. For instance: > > with_items: > - {{ foo }} > > Should be written as: > > with_items: > - "{{ foo }}" > > root@ansibile-launch:~/ansible/tasks/add-compute# > > root@ansibile-launch:~/ansible/tasks/add-compute# cat add-compute.yml > --- > # Demo Adding Compute Node > - name: Adding Compute Node > hosts: build_node > connection: local > gather_facts: no > > > tasks: > - name: Copy Test > ansible_user: "{{build_username}}" > ansible_ssh_pass: "{{build_password}}" > ansible_connection: ssh > command: cp /root/arahim/ansible/tasks/add-compute.yml > /root/arahim/ansible/tasks/add-compute.yml.bak > root@ansibile-launch:~/ansible/tasks/add-compute# cat inventory.yml > fabric01: > hosts: > build_node: > build_host: 192.168.115.101 > build_username: root > build_password: 123Abdul123 > > > It does work with below > > > root@ansibile-launch:~/ansible/tasks/add-compute# ansible-playbook -i > new_inventory test.yml > [DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user > and make sure become_method is 'sudo' (default). This feature will be > removed in version 2.9. Deprecation warnings can be disabled by > setting deprecation_warnings=False in ansible.cfg. > > PLAY [all] > ****************************************************************************************************************************************************************************************************** > > TASK [Gathering Facts] > ****************************************************************************************************************************************************************************************** > ok: [192.168.115.101] > > TASK [Copy file] > ************************************************************************************************************************************************************************************************ > changed: [192.168.115.101] > > PLAY RECAP > ****************************************************************************************************************************************************************************************************** > 192.168.115.101 : ok=2 changed=1 unreachable=0 failed=0 > > root@ansibile-launch:~/ansible/tasks/add-compute# cat new_inventory > [hosts] > 192.168.115.101 ansible_connection=ssh ansible_ssh_user=root > ansible_ssh_pass=123Abdul123 > > root@ansibile-launch:~/ansible/tasks/add-compute# cat test.yml > --- > - hosts: all > user: root > vars: > createuser: 'ansible' > createpassword: '123Abdul123' > tasks: > - name: Copy file > command: cp /root/arahim/ansible/tasks/add-compute.yml > /root/arahim/ansible/tasks/add-compute.yml.bak > sudo: true > > > Not sure what is wrong with the yml version of inventory and the variables > called .. but I am able to now make progress , thanks for getting back to > me on this > > Regards, > AR > > On Wed, Nov 14, 2018 at 1:26 PM Brian Coca <[email protected]> wrote: > >> Without an error I can only guess, one thing i've noticed is that you >> are incorrectly formatting the task >> >> - name: return motd to registered var >> command: 'cp /root/setup_data.yaml /root/setup_data.yaml.bak' >> vars: >> ansible_user= "{{build_username}}" >> ansible_ssh_pass= "{{build_password}}" >> >> >> >> -- >> ---------- >> Brian Coca >> >> -- >> 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/CACVha7fh-MUbzxu2zp8Abat5URfJekrvpO4K8yoWqx%2BDasBO4w%40mail.gmail.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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/CAL7z%3DgcjTzkkF4p_SriaC8ZR0vdO7SC_LErcffGGStSATFrq%2BA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAL7z%3DgcjTzkkF4p_SriaC8ZR0vdO7SC_LErcffGGStSATFrq%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAJ%2BRxtRhmccoa_uPub7iKoj_Nk03DFRRXfz%2BPgqZVBN6zTxCQw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
