Hi .
I have a playbook for icinga which applies the nrpe config to a list of hosts in inventory file .
The problem I have is that within the same playbook I have another role which needs to copy host specific config to an icinga server in different environments.
I can use a template
e.g.
- name: copy host script
template:
src: hostname.j2
dest: /home/rcromwell/{{ ansible_hostname }}.{{ansible_domain}}
But the the “dest:” needs to be the the icinga server . Not the client . Is there a way to achieve this ?
Here is an example what I am trying achieve using set_facts …
e.g.
-
include: set_facts.yml
-
name: ‘dev’
set_fact:
ic2host: ic2.dev.yoo.com
when: >
ansible_env == “dev.yoo.com” -
name: ‘dev2’
set_fact:
ic2host: ic2.dev2.yoo.com
when: >
ansible_env == “dev2.yoo.com” -
name: copy host script
template:
src: hostname.j2
dest: {{ ic2host }}/home/rcromwell/{{ ansible_hostname }}.{{ansible_domain}}
Any hel would be appreciated … //