Skip to content

Commit

Permalink
Merge pull request geerlingguy#17 from geerlingguy/bluelabsio-amazon-…
Browse files Browse the repository at this point in the history
…linux-support

Don't install repo if it is already installed
  • Loading branch information
geerlingguy authored Sep 16, 2016
2 parents 82dd6dc + fc077f5 commit fdfd791
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ galaxy_info:
- 7
galaxy_tags:
- packaging
- epel
- repository
- repo
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
Expand All @@ -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

0 comments on commit fdfd791

Please sign in to comment.