Hello,
I'm trying to create an Ansible role, networking, to automate
/etc/resolv.conf file. I created this role like below:
production
networking.yml
group_vars/
agroup
bgroup
roles/
networking/
tasks/main.yml
templates/resolv.conf.j2
In my resolv.conf.j2 file, I put variables in this file:
{% for item in nameserver %}
nameserver {{ item }}
{% endfor %}
The name servers will be different for different group systems.
In group_vars/agroup:
---
nameservers:
- 192.168.10.251
- 192.168.10.252
In group_vars/bgroup:
---
nameservers:
- 192.168.101.251
- 192.168.101.252
In playbook networking.yml:
---
- hosts: all
roles:
- networking
In production (inventory) file:
[agroup]
myserver
[bgroup]
myserver2
Here is command I want to use for play:
$ ansible-playbook -i production networking.yml -l myserver
$ ansible-playbook -i production networking.yml -l myserver2
Does above play use agroup defined nameservers for myserver, and bgroup
defined nameservers for myserver2?
Thank you,
- Xinhuan
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/dcbd0424-dd54-4fe5-8de7-940a470c0476%40googlegroups.com.