ansible-vault icon indicating copy to clipboard operation
ansible-vault copied to clipboard

templates: backend raft: resolve to proper interface

Open jimnydev opened this issue 3 years ago • 6 comments

This for loop is looping through all (remaining) hosts from group - but it's using vault_iface value of current host. I believe that's part of the issue with #211

There's also another change - instead of ['ansible' + vault_iface] hostvars key - I've switched it to ansible_facts instead - as that one seems to be (always?) available. I'm not sure if presence of 'ansible_' + vault_iface hostvars dict depends on ansible version, but either way - I've tried it on a couple of setups/installations and it seems to be passing everywhere.

Thanks.

jimnydev avatar Mar 18 '22 11:03 jimnydev

@jimnydev I still have the same issue even with the updated config file in your commit when running the test.

I added a VM under [vault_raft_servers] in test/inventory.ini file. Am I missing something? Thanks in advance for the help.

kartuhn avatar Apr 07 '22 16:04 kartuhn

Hosts should be listed within [vault_raft_servers] group, and if interface names differ across the hosts - you should specify vault_iface var for every host.

Which error are you seeing exactly? Thanks!

jimnydev avatar Apr 08 '22 02:04 jimnydev

@jimnydev Thanks.

This is the tests/inventory.ini file. raft is just another ssh-able VM.

localhost

[vault_raft_servers]
raft

The error that I'm getting, which I believe is related to #211 when running the main vault configuration task.

{"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'enp0s10'"}

Could you please tell how to specify vault_iface for each hosts? Thanks in advance!

kartuhn avatar Apr 08 '22 02:04 kartuhn

In your example:

localhost

[vault_raft_servers]
raft vault_iface=interface_name_goes_here

jimnydev avatar Apr 08 '22 02:04 jimnydev

@jimnydev Thanks, I tried the following.

localhost

[vault_raft_servers]
raft vault_iface=enp0s10

I can also confirm that interface on the localhost and raft in my example are the same using the nmcli device status

To add more context, this is how my tests/test.yaml looks like

---
- hosts: localhost
  connection: local
  remote_user: test
  become: true
  become_user: root
  roles:
    - ansible-vault

Could you please let me know if I'm missing something?

kartuhn avatar Apr 08 '22 03:04 kartuhn

Can you try this commit instead?

https://github.com/jimnydev/ansible-vault/commit/7368f4f4a3e815482c3598d9cce80eed2ee0f55e

jimnydev avatar Apr 14 '22 09:04 jimnydev

Please resolve conflicts.

bbaassssiiee avatar Oct 06 '22 21:10 bbaassssiiee

It looks like this was reworked in the meantime - so this PR is now pointless.

Thanks!

jimnydev avatar Oct 07 '22 11:10 jimnydev