diff --git a/.travis.yml b/.travis.yml index e8b1c75..2324bb8 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 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' diff --git a/defaults/main.yml b/defaults/main.yml index eb75e47..ead9b81 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" 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 6e89d5b..0963e49 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: Check if EPEL repo is already configured. + stat: path={{ epel_repofile_path }} + register: epel_repofile_result + - name: Install EPEL repo. yum: name: "{{ epel_repo_url }}" @@ -7,8 +11,10 @@ until: '"failed" not in result' retries: 5 delay: 10 + 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_result.stat.exists