redhat.yml 1.09 KB
Newer Older
Bengt Giger's avatar
Bengt Giger committed
1
2
3
4
5
6
7
---
- name: Set excluded packages
  ini_file:
    path: "{{ __system_update_manager_pkgmgr_config }}"
    section: main
    option: exclude
    unsafe_writes: true
8
    mode: "0644"
Bengt Giger's avatar
Bengt Giger committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    value: "{{ system_update_manager_excluded | join(' ') }}"

# tracer detects if a system has to be rebooted
- name: Ensure tracer tracer is installed (EL7)
  package:
    name: python2-tracer
  when: ansible_distribution_major_version == "7"

- name: Ensure tracer tracer is installed (EL8)
  package:
    name: python3-tracer
  when: ansible_distribution_major_version >= "8"

- name: Run full update
  block:

    - name: Update system
      yum:
        name: "*"
        state: latest
        # exclude: "ansible,{{ system_update_manager_excluded | join(',') }}"
        exclude: "ansible"

    - name: Check if reboot is required
      command: tracer
      register: tracer_output
      ignore_errors: true
      changed_when: false

38
39
    - name: Set flag if reboot is required
      set_fact:
Bengt Giger's avatar
Bengt Giger committed
40
41
42
43
        system_update_manager_reboot_required: true
      when: tracer_output.rc != 0

  when: system_update_manager_forceupdate == true