added update_system role

This commit is contained in:
2023-05-02 20:24:58 +02:00
parent e257e44971
commit 577f859930
3 changed files with 40 additions and 0 deletions

View File

@@ -20,6 +20,13 @@
- borgbackup - borgbackup
tags: borgbackup tags: borgbackup
- name: Update the system
hosts: all
become: true
roles:
- update_system
tags: update
#################################################### Service Roles ############################################################ #################################################### Service Roles ############################################################
- name: Configure Nginx Proxy Manager - name: Configure Nginx Proxy Manager

View File

@@ -0,0 +1,30 @@
---
- name: Update apt cache and packages
ansible.builtin.apt:
update_cache: true
name: "*"
state: latest
register: updates_applied
- debug: var=updates_applied
- name: reboot the system
ansible.builtin.reboot:
reboot_timeout: 3600
when: updates_applied.changed == true
- name: Autoremove no longer needed packages
ansible.builtin.apt:
autoremove: true
- name: Create custom fact directorie
ansible.builtin.file:
state: directory
recurse: true
path: /etc/ansible/facts.d
- name: set last_update local fact
ansible.builtin.template:
src: last_update.j2
dest: /etc/ansible/facts.d/last_update.fact
when: updates_applied.changed == true

View File

@@ -0,0 +1,3 @@
{
"date": "{{ ansible_date_time.date }}"
}