Skip to content

Commit

Permalink
Simplify, reboot if required
Browse files Browse the repository at this point in the history
  • Loading branch information
Encephala committed Dec 19, 2023
1 parent 45e1916 commit 5d1e3a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions playbooks/apt_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,31 @@
hosts: VM, container
become: true

pre_tasks:
- name: Ensure Debian or Ubuntu
ansible.builtin.fail:
msg: "This playbook only works on Debian or Ubuntu"
when: ansible_distribution != "Debian" and ansible_distribution != "Ubuntu"

tasks:
- name: Update
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600

when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu"

- name: Upgrade
ansible.builtin.apt:
upgrade: full

when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu"
- name: Check if reboot required
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required

- name: Reboot if required
ansible.builtin.reboot:
reboot_timeout: 60
when: reboot_required.stat.exists


# TODO: reboot als nodig
2 changes: 1 addition & 1 deletion roles/provision/tasks/system_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
upgrade: "yes"
upgrade: full

- name: Install packages
ansible.builtin.apt:
Expand Down

0 comments on commit 5d1e3a4

Please sign in to comment.