diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-09-11 14:29:25 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-09-11 14:29:25 +0200 |
commit | d75b40d57705551e618bb280b6b27149f695aed9 (patch) | |
tree | 961405bfe07a07b02610216c9c838f0c2775dbef /roles/pacman/tasks | |
parent | rate_mirrors: drop dependency on etckeeper role, refactoring (diff) | |
download | infra-ansible-d75b40d57705551e618bb280b6b27149f695aed9.tar.gz infra-ansible-d75b40d57705551e618bb280b6b27149f695aed9.zip |
pacman: drop dependency on etckeeper role + refactoring
Diffstat (limited to 'roles/pacman/tasks')
-rw-r--r-- | roles/pacman/tasks/main.yml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/roles/pacman/tasks/main.yml b/roles/pacman/tasks/main.yml index df7fac7..213ef01 100644 --- a/roles/pacman/tasks/main.yml +++ b/roles/pacman/tasks/main.yml @@ -11,6 +11,12 @@ - name: Reboot if necessary ansible.builtin.meta: flush_handlers rescue: + - name: Check if /etc is versioned + ansible.builtin.file: + path: /etc/.git/config + state: file + register: etc_versioned + - name: Fail if /etc is not versioned ansible.builtin.fail: msg: Upgrading packages failed for an unknown reason! @@ -23,7 +29,7 @@ register: git_status changed_when: false - - name: Fail if there're no unstaged changes in /etc + - name: Fail if there're no uncommitted changes in /etc ansible.builtin.fail: msg: Upgrading packages failed for an unknown reason! when: not git_status.stdout @@ -38,11 +44,12 @@ chdir: /etc register: only_gnupg changed_when: false + failed_when: only_gnupg.rc not in [0, 1] - - name: Commit changes in /etc + - name: Commit changes in /etc/pacman.d/gnupg ansible.builtin.command: | etckeeper commit 'pacman: GPG keys' - when: git_status.stdout and only_gnupg.rc != 0 + when: only_gnupg.rc == 1 - name: Retry upgrading packages community.general.pacman: |