On Thu, Apr 18, 2019, at 9:50 AM, vikram acharya wrote: > Hello Jonathan > > Thanks for support can you help with more detail If possible.. am kind of > new ansible world .. is their any mistake in play book ? > >
You need 'gather_facts: yes' V/r, James Cassell > > > On Thu, Apr 18, 2019, 19:12 Jonathan Lozada De La Matta <[email protected]> > wrote: > > > > > https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variables-discovered-from-systems-facts > > > > On Thu, Apr 18, 2019 at 9:36 AM vikram acharya <[email protected]> > > wrote: > > > >> Hello team , > >> > >> Am trying to install lamp i have written playbook in this manner . My > >> system are system connected AWS i can do ssh to Redhat node from Ansible > >> control server > >> > >> Need help to resolve the problem > >> > >> > >> --- > >> - hosts: all > >> become: yes > >> gather_facts:no > >> tasks: > >> - name: fail for other platform > >> fail: > >> msg: "this playbook is for RHEL" > >> when: ansible_facts['os_family'] == "Redhat" > >> - name: install httpd > >> yum: > >> name: httpd > >> state: present > >> - name: service > >> service: > >> name: httpd > >> state: present > >> > >> - name: install php modules > >> yum: > >> name: "{{ item }}" > >> state: present > >> loop: > >> - php > >> - php-mysql > >> - php-pdo > >> - php-gd > >> - php-mbstring > >> > >> ansible@ip-172-31-18-96:/etc/playbook$ ansible-playbook -i inventory > >> lamp.yml > >> > >> > >> PLAY [web] > >> *************************************************************************************************************************************************** > >> > >> > >> TASK [fail for other platforms] > >> ******************************************************************************************************************************fatal: > >> [172.31.17.222]: FAILED! => {"msg": "The conditional check > >> 'ansible_facts['os_family'] == \"Redhat\"' failed. The error was: error > >> while evaluating conditional (ansible_facts['os_family'] == \"Redhat\"): > >> 'dict object' has no attribute 'os_family'\n\nThe error appears to have > >> been in '/etc/playbook/lamp.yml': line 6, column 5, but may\nbe elsewhere > >> in the file depending on the exact syntax problem.\n\nThe offending line > >> appears to be:\n\n tasks:\n - name: fail for other platforms\n ^ > >> here\n"} > >> fatal: > >> [localhost]: FAILED! => {"msg": "The conditional check > >> 'ansible_facts['os_family'] == \"Redhat\"' failed. The error was: error > >> while evaluating conditional (ansible_facts['os_family'] == \"Redhat\"): > >> 'dict object' has no attribute 'os_family'\n\nThe error appears to have > >> been in '/etc/playbook/lamp.yml': line 6, column 5, but may\nbe elsewhere > >> in the file depending on the exact syntax problem.\n\nThe offending line > >> appears to be:\n\n tasks:\n - name: fail for other platforms\n ^ > >> here\n"} > >> [WARNING]: > >> Could not create retry file '/etc/playbook/lamp.retry'. [Errno 13] > >> Permission denied: u'/etc/playbook/lamp.retry' > >> > >> > >> > >> > >> PLAY RECAP > >> ***************************************************************************************************************************************************172.31.17.222 > >> : ok=0 changed=0 unreachable=0 failed=1 > >> > >> localhost : ok=0 changed=0 unreachable=0 failed=1 > >> > >> mintty screen dump > >> > >> Inventory file > >> > >> [web] > >> > >> 172.31.17.222 > >> > >> localhost > >> > >> > >> > >> > >> > >> [dbserver] > >> > >> 172.31.17.101 > >> > >> > >> > >> [local] > >> > >> > >> localhost > >> > >> Thanks in advance > >> > >> Regards > >> Vikram > >> > >> -- > >> 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/CAFAnimCGYOYrV16RGTTfy9V-F%2B%3D4YfYZLPcxKYG9%2BOReuvNR9w%40mail.gmail.com > >> <https://groups.google.com/d/msgid/ansible-project/CAFAnimCGYOYrV16RGTTfy9V-F%2B%3D4YfYZLPcxKYG9%2BOReuvNR9w%40mail.gmail.com?utm_medium=email&utm_source=footer> > >> . > >> For more options, visit https://groups.google.com/d/optout. > >> > > > > > > -- > > > > Jonathan lozada de la matta > > > > AUTOMATION PRACTICE > > > > > > > > > > -- > > 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/CAFYJA%2BJBvqAxhVxe33QTDMrYX%2Bg6ueNstvLHWET9WY_9eYUp4w%40mail.gmail.com > > <https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJBvqAxhVxe33QTDMrYX%2Bg6ueNstvLHWET9WY_9eYUp4w%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/CAFAnimBoYV%3D7s6o9Kg3U0rZjDgvysr6-aKVQ3R85QsBtF10k%3DA%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/1555596739.1836878.1669018552.4D359FFC%40webmail.messagingengine.com. For more options, visit https://groups.google.com/d/optout.
