From f20e3bf3557451047a3ab035de503cd2ce35a550 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 21 May 2023 19:01:59 +0200 Subject: fix some ansible-lint warnings --- roles/rate_mirrors/tasks/main.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'roles/rate_mirrors/tasks/main.yml') 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' -- cgit v1.2.3