summaryrefslogtreecommitdiff
path: root/upgrade.yml
blob: 4beddd468b876be8214972fccd6ba828a74b4b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: Upgrade packages
  hosts: internal
  gather_facts: false
  tasks:
    - name: Update and upgrade
      apt:
        update_cache: true
        upgrade: safe
        cache_valid_time: 3600
      register: result
    - name: Dump debug result
      debug:
        var: result
    - name: Check if reboot required
      stat:
        path: /var/run/reboot-required
      register: reboot_required_file
    - name: Reboot if required
      reboot:
      when: reboot_required_file.stat.exists