[Ansible-project]

32 views
Skip to first unread message

vikram acharya

unread,
Apr 18, 2019, 9:36:08 AM4/18/19
to ansible...@googlegroups.com
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 con
ditional (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 f
or other platforms\n    ^ here\n"}                                                                                                                            
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'ansible_facts['os_family'] == \"Redhat\"' failed. The error was: error while evaluating conditi
onal (ansible_facts['os_family'] == \"Redhat\"): 'dict object' has no attribute 'os_family'\n\nThe error appears to have been in '/etc/playbook/lamp.yml': lin
e 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 o
ther 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

Jonathan Lozada De La Matta

unread,
Apr 18, 2019, 9:42:17 AM4/18/19
to ansible...@googlegroups.com

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFAnimCGYOYrV16RGTTfy9V-F%2B%3D4YfYZLPcxKYG9%2BOReuvNR9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--

Jonathan lozada de la matta

AUTOMATION PRACTICE



 

vikram acharya

unread,
Apr 18, 2019, 9:51:18 AM4/18/19
to ansible...@googlegroups.com
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 ? 




Vijay Ravindran

unread,
Apr 18, 2019, 10:11:27 AM4/18/19
to ansible...@googlegroups.com
Viktam,   As a work around try updating as
 "ansible_os_family": "RedHat",
as per the document provided by Jon.

James Cassell

unread,
Apr 18, 2019, 10:12:39 AM4/18/19
to Ansible List
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
> >> 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 ansible-proje...@googlegroups.com.
> >> To post to this group, send email to ansible...@googlegroups.com.
> >> 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 ansible-proje...@googlegroups.com.
> > To post to this group, send email to ansible...@googlegroups.com.
> > 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFAnimBoYV%3D7s6o9Kg3U0rZjDgvysr6-aKVQ3R85QsBtF10k%3DA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages