diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c500e1..c68e866 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,12 +10,4 @@ repos: args: - ansible language: python - exclude: | - (?x)( - ^deprecated/| - ^infra/| - ^runbooks/| - ^wiki-resources/| - ^\.pre-commit-config.yaml| - ^\.gitignore - ) + files: ^ansible/.*$ diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 1435620..9544450 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,3 +1,3 @@ [defaults] -stdout_callback = yaml +result_format = yaml diff --git a/ansible/inventory.yaml b/ansible/inventory.yaml index 8808b7d..32e7c65 100644 --- a/ansible/inventory.yaml +++ b/ansible/inventory.yaml @@ -1,3 +1,6 @@ nigel: hosts: nigel.local: +shockrah_xyz: + hosts: + shockrah.xyz diff --git a/ansible/playbook/vultr-static-update.yaml b/ansible/playbook/vultr-static-update.yaml new file mode 100644 index 0000000..0646c7a --- /dev/null +++ b/ansible/playbook/vultr-static-update.yaml @@ -0,0 +1,17 @@ +--- +- name: Ensure latest system updates are applied to the host + hosts: shockrah.xyz + remote_user: webadmin + tasks: + - name: Run system upgrade and update cache + become: true + ansible.builtin.apt: + update_cache: true + upgrade: safe + - name: Reboot Host Trigger + tags: + - reboot + ansible.builtin.debug: + msg: "Rebooting host now" + notify: Reboot Host + diff --git a/ansible/roles/webserver/handlers/main.yaml b/ansible/roles/webserver/handlers/main.yaml index 2e159fc..d5c922f 100644 --- a/ansible/roles/webserver/handlers/main.yaml +++ b/ansible/roles/webserver/handlers/main.yaml @@ -1,4 +1,6 @@ -- name: Restart host to apply any changes and clear out uptime stuff +- name: Reboot Host become: true + tags: + - reboot ansible.builtin.reboot: msg: "Reboot initiated as a part of housekeeping" diff --git a/ansible/roles/webserver/tasks/main.yaml b/ansible/roles/webserver/tasks/main.yaml index 3d090dc..a522e26 100644 --- a/ansible/roles/webserver/tasks/main.yaml +++ b/ansible/roles/webserver/tasks/main.yaml @@ -6,3 +6,9 @@ autoclean: true autoremove: true upgrade: safe +- name: Notify the reboot + tags: + - reboot + ansible.builtin.debug: + msg: "Restarting the host itself" + notify: Reboot Host