On 17.02.2018 23:20, Brigzzy Briggs wrote:
I tried that, but it didn't work.  Thanks for the reply all the same!

Here's the section of the playbook. Let me know if you can see the issue,
or if I can post anything else that would help.

- hosts: nagios-server
  become: yes
    - name: Generate Configs
dest=/usr/local/nagios/etc/servers/{{ item }}.cfg owner=root mode=0644
      with_items: "{{groups['nagios-monitored']}}"

This is the error the playbook spits out.  It throws it for all the
servers, not just the FreePBX one.

failed: [nagios.domain.com] (item=freepbx.domain.com) => {"failed":
true, "item": "freepbx.domain.com", "msg": "AnsibleUndefinedVariable:
'dict object' has no attribute 'ansible_os_family'"}

You don't have access to the facts the hosts in group nagios-monitored, that's the reason it fails.

So you need to enable fact caching

or gather the facts before you run the nagios-server play.
Facts gathered in one play is available in subsequent plays as long as they are in the same playbook.

- hosts: nagios-monitored
  gather_facts: yes

- hosts: nagios-server
  become: yes
- name: Generate Configs

Kai Stian Olstad

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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to