Use inventory_hostname_short to align with node name in k3s
This commit is contained in:
parent
4361ecc3a0
commit
85b01cc4ab
1 changed files with 3 additions and 3 deletions
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
# For NixOS, we just run the upgrade and check if a reboot is flagged.
|
||||
- name: Run NixOS update command
|
||||
command: sudo nix flake update --flake $NIX_FLAKE_PATH && sudo nixos-rebuild switch --flake $NIX_FLAKE_PATH#$HOSTNAME
|
||||
command: sudo nix flake update --flake $NIX_FLAKE_PATH && sudo nixos-rebuild switch --flake $NIX_FLAKE_PATH#{{ inventory_hostname_short }}
|
||||
register: nixos_status
|
||||
when: inventory_hostname in groups['k3s_agents_nixos']
|
||||
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
# --- THE KUBERNETES DRAIN PHASE ---
|
||||
- name: Drain the node safely
|
||||
command: >
|
||||
sudo k3s kubectl drain {{ inventory_hostname }}
|
||||
sudo k3s kubectl drain {{ inventory_hostname_short }}
|
||||
--ignore-daemonsets
|
||||
--delete-emptydir-data
|
||||
--force
|
||||
|
|
@ -50,6 +50,6 @@
|
|||
|
||||
# --- THE UNCORDON PHASE ---
|
||||
- name: Uncordon the node
|
||||
command: sudo k3s kubectl uncordon {{ inventory_hostname }}
|
||||
command: sudo k3s kubectl uncordon {{ inventory_hostname_short }}
|
||||
delegate_to: "{{ active_master }}"
|
||||
when: (reboot_required.stat.exists | default(false)) or ('changed' in nixos_status | default({}))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue