home-server/roles/cleanupdate/tasks/main.yml

45 lines
1.3 KiB
YAML

---
# The home-server project produces a multi-purpose setup using Ansible.
# Copyright © 2018 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
### UPSTREAM BEGIN ⇒ ###
- name: pull prerequisites from upstream
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=upstream.yml
vars:
msg: pacman clean update
### ⇐ UPSTREAM BEGIN ###
- name: check for unused software
shell: |
pacman -Qtdq || true
register: unused_software
changed_when: false
- name: remove unused software
command: |
pacman -Rns --noconfirm --noprogressbar {{unused_software.stdout}}
when:
- (unused_software.stdout is defined)
- (unused_software.stdout != "")
- name: clean packages metadata and cache
command: |
pacman -Sc --noconfirm --noprogressbar
changed_when: false
- name: update installed software
command: |
pacman -Syuq --noconfirm --noprogressbar --ignore {{software_to_ignore}}
register: update_result
changed_when:
- (update_result.stdout is defined)
- (update_result.stdout.find('there is nothing to do') == -1)
### UPSTREAM END ⇒ ###
- name: merge upstream
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=merge.yml
vars:
msg: pacman clean update
### ⇐ UPSTREAM END ###