On 20. okt. 2017 13:11, parwinderjit singh wrote:
> i have a below inventory file
>
> [ansible]
> parv-vm-01 ansible_ssh_host=10.48.21.99 host_fqdn=parv-vm-01
>
> [cloudera_mysql]
> parv-vm-02 ansible_ssh_host=10.48.21.94 host_fqdn=parv-vm-02
>
> [cloudera_manager]
>
> [cloudera_data]
> parv-vm-06 ansible_ssh_host=10.48.21.85 host_fqdn=parv-vm-06
> parv-vm-07 ansible_ssh_host=10.48.21.84 host_fqdn=parv-vm-07
> parv-vm-01 ansible_ssh_host=10.48.21.99 host_fqdn=parv-vm-01
>
>
>
> I want to create a nagios host file which contain all the IP which are
> there in my inventory file like below
>
>
>
> define host{
> use linux-server
> host_name parv-vm-06
> alias parv-vm-06
> address 10.48.21.85
> max_check_attempts 5
> check_period 24x7
> notification_interval 30
> notification_period 24x7
> }
>
>
> define host{
> use linux-server
> host_name parv-vm-07
> alias parv-vm-07
> address 10.48.21.84
> max_check_attempts 5
> check_period 24x7
> notification_interval 30
> notification_period 24x7
> }
>
> How can i make this. can anyone tell me
You can use the template module for loop over group['all'], this is a special
group that contains all the hosts in the inventory.
To get variable of a host use hostvars['name'] or hostvars[variable]
--
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 [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/95cd1497-9575-cbc0-2cdf-4e8fbb3b02d2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.