Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inventory_hostname instead of ansible_hostname #274

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
mode: 0644

- name: Init first server node
# Handle both hostname OR ip address being supplied in inventory
when: ansible_hostname == groups['server'][0] or groups['server'][0] in ansible_facts['all_ipv4_addresses']
when: inventory_hostname == groups['server'][0]
block:
- name: Copy K3s service file [Single]
when: groups['server'] | length == 1
Expand Down Expand Up @@ -143,7 +142,7 @@
- name: Start other server if any and verify status
when:
- (groups['server'] | length) > 1
- ansible_hostname != groups['server'][0]
- inventory_hostname != groups['server'][0]
block:
- name: Copy K3s service file [HA]
when: groups['server'] | length > 1
Expand Down
Loading