mirror of
https://github.com/dredx/prole.git
synced 2026-09-27 13:04:30 +00:00
22 lines
728 B
YAML
22 lines
728 B
YAML
---
|
|
- name: Gather service facts
|
|
ansible.builtin.service_facts:
|
|
|
|
# Agents can sometimes be in a Restart=always loop; disabling stops the loop.
|
|
- name: Stop and disable k3s-agent service when present
|
|
ansible.builtin.systemd:
|
|
name: k3s-agent
|
|
state: stopped
|
|
enabled: false
|
|
when:
|
|
- ('k3s-agent' + '.service') in ansible_facts.services
|
|
- ansible_facts.services['k3s-agent' + '.service'].status != 'not-found'
|
|
|
|
- name: Clear failed state for k3s-agent (if any)
|
|
ansible.builtin.command: systemctl reset-failed k3s-agent
|
|
changed_when: false
|
|
failed_when: false
|
|
when:
|
|
- ('k3s-agent' + '.service') in ansible_facts.services
|
|
- ansible_facts.services['k3s-agent' + '.service'].status != 'not-found'
|