Unverified Commit 078b0319 authored by Michal Stanke's avatar Michal Stanke Committed by GitHub
Browse files

fix: make the roles work even when hosts are aliased in the inventory (#399)



Signed-off-by: default avatarMichal Stanke <michal@stanke.cz>
parent c3832792
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@
          skip: true

    - name: Run K3s Install [server]
      when: inventory_hostname in groups['server']
      when: inventory_hostname in groups['server'] or ansible_host in groups['server']
      ansible.builtin.command:
        cmd: /usr/local/bin/k3s-install.sh
      environment:
@@ -106,7 +106,7 @@
      changed_when: true

    - name: Run K3s Install [agent]
      when: inventory_hostname in groups['agent']
      when: inventory_hostname in groups['agent'] or ansible_host in groups['agent']
      ansible.builtin.command:
        cmd: /usr/local/bin/k3s-install.sh
      environment:
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@
      register: _server_config_result

- name: Init first server node
  when: inventory_hostname == groups[server_group][0]
  when: inventory_hostname == groups[server_group][0] or ansible_host == groups[server_group][0]
  block:
    - name: Copy K3s service file [Single]
      when: groups[server_group] | length == 1 or use_external_database
@@ -205,7 +205,7 @@
- name: Start other server if any and verify status
  when:
    - (groups[server_group] | length) > 1
    - inventory_hostname != groups[server_group][0]
    - inventory_hostname != groups[server_group][0] and ansible_host != groups[server_group][0]
  block:
    - name: Get the token from the first server
      ansible.builtin.set_fact: