/home/travis/.ansible/roles/robertdebock.update/tasks/main.yml
---
# tasks file for update
- name: include assert.yml
  include_tasks: assert.yml

- name: update cache (apk)
  apk:
    update_cache: yes
  when:
    - ansible_pkg_mgr == "apk"
  changed_when: no

- name: update all software (apk)
  apk:
    upgrade: yes
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "apk"

- name: update all software (apt)
  apt:
    update_cache: yes
    upgrade: "{{ update_upgrade_command }}"
    cache_valid_time: "{{ update_cache_valid_time }}"
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "apt"

- name: apt autoremove (apt)
  apt:
    autoremove: "{{ update_autoremove }}"
  when:
    - ansible_pkg_mgr == "apt"
    - update_autoremove == "yes"
  tags:
    - skip_ansible_lint

- name: update all software (dnf)
  dnf:
    name: "*"
    state: latest
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "dnf"
  tags:
    - skip_ansible_lint

- name: update all software (pacman)
  pacman:
    update_cache: yes
    upgrade: yes
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "pacman"
  tags:
    - skip_ansible_lint

- name: update all software (yum/6)
  yum:
    name: "*"
    state: latest
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "yum"
    - ansible_distribution_major_version == "6"
  tags:
    - skip_ansible_lint

- name: update all software (yum/7)
  yum:
    name: "*"
    state: latest
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "yum"
    - ansible_distribution_major_version == "7"
  tags:
    - skip_ansible_lint

- name: install yum-utils
  package:
    name: yum-utils
  when:
    - ansible_pkg_mgr == "yum"
    - ansible_distribution_major_version == "7"

- name: update all software (zypper)
  zypper:
    name: "*"
    state: latest
  notify:
    - reboot
  when:
    - ansible_pkg_mgr == "zypper"
  tags:
    - skip_ansible_lint