From d162a1b64d8765c2bacebd07887c08a6e45d248f Mon Sep 17 00:00:00 2001 From: Vince Broz Date: Sat, 16 Jul 2016 15:04:14 -0400 Subject: [PATCH 1/7] Don't install repo if it is already installed --- tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index 6e89d5b..7856680 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: Check for existing EPEL repo + stat: path=/etc/yum.repos.d/epel.repo + register: repofile + - name: Install EPEL repo. yum: name: "{{ epel_repo_url }}" @@ -7,8 +11,10 @@ until: '"failed" not in result' retries: 5 delay: 10 + when: repofile is not defined - name: Import EPEL GPG key. rpm_key: key: "{{ epel_repo_gpg_key_url }}" state: present + when: repofile is not defined From 7910a4a2d6eb91e1329d0ac2f4d4fd2817cea540 Mon Sep 17 00:00:00 2001 From: Vince Broz Date: Tue, 19 Jul 2016 14:21:32 -0400 Subject: [PATCH 2/7] Rename, adjust use of repofile --- tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 7856680..a0cb78f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Check for existing EPEL repo stat: path=/etc/yum.repos.d/epel.repo - register: repofile + register: epel_repofile - name: Install EPEL repo. yum: @@ -11,10 +11,10 @@ until: '"failed" not in result' retries: 5 delay: 10 - when: repofile is not defined + when: epel_repofile.exists == False - name: Import EPEL GPG key. rpm_key: key: "{{ epel_repo_gpg_key_url }}" state: present - when: repofile is not defined + when: epel_repofile.exists == False From 981e233c409491cf7581349c57501ee44fbfdc01 Mon Sep 17 00:00:00 2001 From: Vince Broz Date: Tue, 19 Jul 2016 14:22:48 -0400 Subject: [PATCH 3/7] Add epel_repofile_path to defaults --- defaults/main.yml | 1 + tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index eb75e47..994d6ad 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,4 @@ --- epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" epel_repo_gpg_key_url: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" +epel_repofile_path: "/etc/yum.repos.d/epel.repo" \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index a0cb78f..eba90b0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Check for existing EPEL repo - stat: path=/etc/yum.repos.d/epel.repo + stat: path={{ epel_repofile_path }} register: epel_repofile - name: Install EPEL repo. From 900bb0b457614581ccfcaf9d63f48450f84e5979 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 15 Sep 2016 21:31:13 -0500 Subject: [PATCH 4/7] Tweak PR #16. --- defaults/main.yml | 2 +- meta/main.yml | 3 +++ tasks/main.yml | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 994d6ad..ead9b81 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,4 +1,4 @@ --- epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" epel_repo_gpg_key_url: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" -epel_repofile_path: "/etc/yum.repos.d/epel.repo" \ No newline at end of file +epel_repofile_path: "/etc/yum.repos.d/epel.repo" diff --git a/meta/main.yml b/meta/main.yml index 6a406d9..75e7fed 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -15,3 +15,6 @@ galaxy_info: - 7 galaxy_tags: - packaging + - epel + - repository + - repo diff --git a/tasks/main.yml b/tasks/main.yml index eba90b0..c32001d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: Check for existing EPEL repo +- name: Check if EPEL repo is already configured. stat: path={{ epel_repofile_path }} - register: epel_repofile + register: epel_repofile_stat - name: Install EPEL repo. yum: @@ -11,10 +11,10 @@ until: '"failed" not in result' retries: 5 delay: 10 - when: epel_repofile.exists == False + when: not epel_repofile_stat.exists - name: Import EPEL GPG key. rpm_key: key: "{{ epel_repo_gpg_key_url }}" state: present - when: epel_repofile.exists == False + when: not epel_repofile_stat.exists From 80c919f8c91be64deef91173848e0dfe2e9d6f0b Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 15 Sep 2016 21:35:22 -0500 Subject: [PATCH 5/7] Fix stat registered result usage. --- tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index c32001d..0963e49 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Check if EPEL repo is already configured. stat: path={{ epel_repofile_path }} - register: epel_repofile_stat + register: epel_repofile_result - name: Install EPEL repo. yum: @@ -11,10 +11,10 @@ until: '"failed" not in result' retries: 5 delay: 10 - when: not epel_repofile_stat.exists + when: not epel_repofile_result.stat.exists - name: Import EPEL GPG key. rpm_key: key: "{{ epel_repo_gpg_key_url }}" state: present - when: not epel_repofile_stat.exists + when: not epel_repofile_result.stat.exists From 6e8cd6ae06bf03770439f94a87eddf580caaee57 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 15 Sep 2016 21:39:15 -0500 Subject: [PATCH 6/7] Fix tests. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8b1c75..478d011 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ script: # Run container in detached state. - 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"' - # Install dependencies. - - 'sudo docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml' + # Ensure EPEL repo is removed. + - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm rm -f /etc/yum.repos.d/epel.repo' # Ansible syntax check. - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check' From fc077f5add0e464779d3eaa8e7978c0d819b968d Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 15 Sep 2016 21:42:16 -0500 Subject: [PATCH 7/7] Another try at fixing epel install testing. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 478d011..2324bb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ script: - 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"' # Ensure EPEL repo is removed. - - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm rm -f /etc/yum.repos.d/epel.repo' + - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm yum -y remove epel-release' # Ansible syntax check. - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'