mrlesmithjr / ansible-consul

Ansible role to install/configure Consul
MIT License
8 stars 5 forks source link

Fix role breakage with dashes in NIC names #45

Closed jardleex closed 7 years ago

jardleex commented 7 years ago

Hello @mrlesmithjr,

during a larger deployment I stumpled (again) the error that variable and fact names must not have dashes (-) in their name. Unfortunately some of our server NIC's names do have a dash in them. This breaks the role at set_facts | Setting Facts. This step searches for the NIC name with a dash but Ansible transforms dashes to underlines internally so the role searches for a NIC name with a dash but needs to search for one with underlines.

As there are already two PR open I first open this issue with a proposed fix.

Adding a | replace filter to consul_bind_interface fixes the issue. So in defaults/main.yml and README.md it should look like:

# Define interface to bind to...(eth0|eth1|enp0s8)
consul_bind_interface: "{{ ansible_default_ipv4['interface'] | replace('-', '_') }}"

Feel free to apply the change yourself otherwise I would create a MR after the #43 and #44 are solved.

Best

Jard

mrlesmithjr commented 7 years ago

@jardleex I have actually run into this myself and I am really liking the way you chose to solve this. I have merged both #43 and #44 so feel free to create a new MR for this. I really appreciate all of your work.

jardleex commented 7 years ago

MR #46 has been opened. Thanks for your time again :)

Best

Jard