Open marcindulak opened 6 years ago
First, let me say thanks for caring! Contributing to FOSS often feels like trees falling silently in the woods! I want to make this useful for others and the documentation could definitely use enhancement!
When I wrote this role I was managing a cluster where I needed to control the network interface to use on a host by host basis. Using hostvars[inventory_hostname]['consul_agent_network_iface']
allows for resolution of the consul_agent_network_iface
as a host var. If you add a group_vars file for you dev-consul group...
---
# group_vars/dev-consul.yml
consul_agent_network_iface: enp0s8
I think you'll be in business. LMK how it goes. I'm open to adding a simplifying role var that makes the role work the way you thought. Drew
Thanks for answering!
The original functionality of setting consul_agent_network_iface
per host is good, and works when setting consul_agent_network_iface
in the inventory file, it works both per host and group:
dev-consul:
vars:
ansible_port: 22
consul_agent_network_iface: 'host variable takes precedence'
hosts:
dev-consul-server1:
ansible_host: 192.168.123.41
consul_agent_network_iface: 'enp0s8'
dev-consul-server2:
ansible_host: 192.168.123.42
consul_agent_network_iface: 'enp0s8'
dev-consul-server3:
ansible_host: 192.168.123.43
consul_agent_network_iface: 'enp0s8'
I have a dynamic inventory that does not know about the network interface for consul, and prefer not to scatter the settings across too many files and keep the source code of the role intact, that's why I assumed it is possible to set consul_agent_network_iface
at the playbook level, using include_role. What is your suggestion about this possibility?
I have the following inventory and playbook:
with ansible 2.4 and 2.5 I'm getting the error:
This is due to:
consul_agent_network_iface
- we want to access the actual value ofconsul_agent_network_iface
consul_agent_network_iface
I believe what we want in https://github.com/andrewrothstein/ansible-consul-cluster/blob/f8be6c70784508ef99f9f83948415fc2ce59818a/vars/main.yml isinstead of
The same for the peer part in
vars/main.yml
.