aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-09-11 14:29:25 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-09-11 14:29:25 +0200
commitd75b40d57705551e618bb280b6b27149f695aed9 (patch)
tree961405bfe07a07b02610216c9c838f0c2775dbef
parentrate_mirrors: drop dependency on etckeeper role, refactoring (diff)
downloadinfra-ansible-d75b40d57705551e618bb280b6b27149f695aed9.tar.gz
infra-ansible-d75b40d57705551e618bb280b6b27149f695aed9.zip
pacman: drop dependency on etckeeper role + refactoring
Diffstat (limited to '')
-rw-r--r--roles/pacman/meta/main.yml2
-rw-r--r--roles/pacman/tasks/main.yml13
2 files changed, 10 insertions, 5 deletions
diff --git a/roles/pacman/meta/main.yml b/roles/pacman/meta/main.yml
deleted file mode 100644
index cc61eb8..0000000
--- a/roles/pacman/meta/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-dependencies:
- - role: etckeeper
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: