aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/rate_mirrors
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--roles/rate_mirrors/tasks/main.yml22
1 files changed, 13 insertions, 9 deletions
diff --git a/roles/rate_mirrors/tasks/main.yml b/roles/rate_mirrors/tasks/main.yml
index 8777fbd..4d76ff3 100644
--- a/roles/rate_mirrors/tasks/main.yml
+++ b/roles/rate_mirrors/tasks/main.yml
@@ -1,41 +1,45 @@
-- become: true
+- name: As root user
+ become: true
block:
- - when: etc_versioned
+ - name: Fail if there're uncommitted changes in /etc
+ when: etc_versioned
block:
- name: Check for changes in /etc
- command: git status --porcelain=v1
+ ansible.builtin.command: git status --porcelain=v1
args:
chdir: /etc
register: git_status
changed_when: false
failed_when: false
- - fail:
+ - ansible.builtin.fail:
msg: There are uncommitted changes in /etc
when: git_status.stdout
- name: Rate pacman mirrors
- shell: |
+ ansible.builtin.shell: |
. /etc/os-release && rate-mirrors \
--allow-root \
--disable-comments \
--save=/etc/pacman.d/mirrorlist \
"$ID"
- - when: etc_versioned
+ - name: Commit pacman.d/mirrorlist
+ when: etc_versioned
block:
- name: Check for changes in /etc
- command: git status --porcelain=v1
+ ansible.builtin.command: git status --porcelain=v1
args:
chdir: /etc
register: git_status
changed_when: false
failed_when: false
- - fail:
+ - name: Fail if there're other uncommitted changes
+ ansible.builtin.fail:
msg: How did this happen?
when: git_status.stdout != ' M pacman.d/mirrorlist'
- name: Commit changes in /etc/pacman.d/mirrorlist
- command: |
+ ansible.builtin.command: |
etckeeper commit 'rate-mirrors'