Add update-instances-repo
This commit is contained in:
33
update-instances-repo
Normal file
33
update-instances-repo
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
- hosts: instances
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Apt Update with Tailscale recovery
|
||||||
|
block:
|
||||||
|
|
||||||
|
- name: Apt Update
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
|
||||||
|
- name: Restart tailscaled if apt update failed
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: tailscaled
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: Retry Apt Update
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Check if patchmon agent exists
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: /usr/local/bin/patchmon-agent
|
||||||
|
register: patchmon_agent
|
||||||
|
|
||||||
|
- name: Patchmon agent update
|
||||||
|
ansible.builtin.command: /usr/local/bin/patchmon-agent report
|
||||||
|
when: patchmon_agent.stat.exists
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
Reference in New Issue
Block a user