diff --git a/files/ansible-playbooks/restart-cloud-agent.yml b/files/ansible-playbooks/restart-cloud-agent.yml new file mode 100644 index 0000000..94eaa1f --- /dev/null +++ b/files/ansible-playbooks/restart-cloud-agent.yml @@ -0,0 +1,25 @@ +--- +- name: Temporarily move cloud-agent and restore it + hosts: all + gather_facts: no + + tasks: + - name: Move /tmp/launchd/services/cloud-agent to /root/ + ansible.builtin.raw: | + set -e + PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH + mv -f /tmp/launchd/services/cloud-agent /root/ + register: move_out + changed_when: true + + - name: Wait 3s before restoring + ansible.builtin.pause: + seconds: 3 + + - name: Move /root/cloud-agent back to /tmp/launchd/services/ + ansible.builtin.raw: | + set -e + PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH + mv -f /root/cloud-agent /tmp/launchd/services/ + register: move_back + changed_when: true