diff --git a/ansible/install/collectd-generic.yml b/ansible/install/collectd-generic.yml index 6836ed01d..3ce00f650 100644 --- a/ansible/install/collectd-generic.yml +++ b/ansible/install/collectd-generic.yml @@ -15,6 +15,7 @@ vars: config_type: baremetal roles: + - epel - collectd-generic tags: baremetal @@ -23,6 +24,7 @@ vars: config_type: guest roles: + - epel - collectd-generic tags: guest @@ -31,5 +33,6 @@ vars: config_type: graphite roles: + - epel - collectd-generic tags: graphite diff --git a/ansible/install/collectd-openstack.yml b/ansible/install/collectd-openstack.yml index 2f4d73c68..b1b09670f 100644 --- a/ansible/install/collectd-openstack.yml +++ b/ansible/install/collectd-openstack.yml @@ -8,6 +8,7 @@ vars: config_type: undercloud roles: + - { role: epel, when: collectd_undercloud } - { role: common, when: collectd_undercloud } - { role: collectd-openstack, when: collectd_undercloud } tasks: @@ -22,6 +23,7 @@ vars: config_type: controller roles: + - { role: epel, when: collectd_controller } - { role: common, when: collectd_controller } - { role: collectd-openstack, when: collectd_controller } tasks: @@ -36,6 +38,7 @@ vars: config_type: ceph roles: + - { role: epel, when: collectd_ceph } - { role: common, when: collectd_ceph } - { role: collectd-openstack, when: collectd_ceph } tasks: @@ -50,6 +53,7 @@ vars: config_type: compute roles: + - { role: epel, when: collectd_compute } - { role: common, when: collectd_compute } - { role: collectd-openstack, when: collectd_compute } tasks: diff --git a/ansible/install/elk.yml b/ansible/install/elk.yml index e9a270fe5..f3f82f370 100644 --- a/ansible/install/elk.yml +++ b/ansible/install/elk.yml @@ -6,6 +6,7 @@ - hosts: elk remote_user: root roles: + - { role: epel } - { role: elasticsearch } - { role: fluentd, when: (logging_backend == 'fluentd') } - { role: logstash, when: ((logging_backend is none) or (logging_backend == 'logstash')) } diff --git a/ansible/install/grafana-docker.yml b/ansible/install/grafana-docker.yml index 82da45c06..4559aab12 100644 --- a/ansible/install/grafana-docker.yml +++ b/ansible/install/grafana-docker.yml @@ -6,4 +6,5 @@ - hosts: grafana remote_user: root roles: + - { role: epel } - { role: grafana_docker } diff --git a/ansible/install/grafana.yml b/ansible/install/grafana.yml index b56039101..cab4196f2 100644 --- a/ansible/install/grafana.yml +++ b/ansible/install/grafana.yml @@ -6,4 +6,5 @@ - hosts: grafana remote_user: root roles: + - { role: epel } - { role: grafana } diff --git a/ansible/install/graphite-docker.yml b/ansible/install/graphite-docker.yml index c842dcf18..cb8dedba0 100644 --- a/ansible/install/graphite-docker.yml +++ b/ansible/install/graphite-docker.yml @@ -6,4 +6,5 @@ - hosts: graphite remote_user: root roles: + - { role: epel } - { role: graphite_docker } diff --git a/ansible/install/graphite.yml b/ansible/install/graphite.yml index c2ae35ab4..1f8080a0a 100644 --- a/ansible/install/graphite.yml +++ b/ansible/install/graphite.yml @@ -6,4 +6,5 @@ - hosts: graphite remote_user: root roles: + - { role: epel } - { role: graphite } diff --git a/ansible/install/roles/collectd-generic/tasks/main.yml b/ansible/install/roles/collectd-generic/tasks/main.yml index fe784f6ae..2f27ec712 100644 --- a/ansible/install/roles/collectd-generic/tasks/main.yml +++ b/ansible/install/roles/collectd-generic/tasks/main.yml @@ -3,20 +3,6 @@ # Install/run collectd for browbeat (Generic) # -- name: Check for EPEL - shell: rpm -qa | grep -q epel-release - ignore_errors: true - register: epel_installed - -# -# (akrzos) I have found the use of the yum module for installing EPEL on rhel7 to encounter issues, -# thus using rpm to install via ansible. This does display a warning in Ansible output. -# -- name: Install EPEL rpm - command: rpm -ivh {{ epel7_rpm }} - become: true - when: epel_installed.rc != 0 - # # (akrzos) yum module works at this point due to the fact the EPEL repo now exists. EPEL rpm is # installed at this point in time. @@ -83,7 +69,3 @@ service: name=collectd state=restarted enabled=true become: true -- name: Disable EPEL - shell: rpm -e epel-release - ignore_errors: true - become: true diff --git a/ansible/install/roles/collectd-openstack/tasks/main.yml b/ansible/install/roles/collectd-openstack/tasks/main.yml index 3b9de2da5..09f6abd2e 100644 --- a/ansible/install/roles/collectd-openstack/tasks/main.yml +++ b/ansible/install/roles/collectd-openstack/tasks/main.yml @@ -3,20 +3,6 @@ # Install/run collectd for browbeat # -- name: Check for EPEL - shell: rpm -qa | grep -q epel-release - ignore_errors: true - register: epel_installed - -# -# (akrzos) I have found the use of the yum module for installing EPEL on rhel7 to encounter issues, -# thus using rpm to install via ansible. This does display a warning in Ansible output. -# -- name: Install EPEL rpm - command: rpm -ivh {{ epel7_rpm }} - become: true - when: epel_installed.rc != 0 - # # (akrzos) yum module works at this point due to the fact the EPEL repo now exists. EPEL rpm is # installed at this point in time. @@ -93,7 +79,3 @@ service: name=collectd state=restarted enabled=true become: true -- name: Disable EPEL - shell: rpm -e epel-release - ignore_errors: true - become: true diff --git a/ansible/install/roles/epel/handlers/main.yml b/ansible/install/roles/epel/handlers/main.yml new file mode 100644 index 000000000..8b49c741e --- /dev/null +++ b/ansible/install/roles/epel/handlers/main.yml @@ -0,0 +1,8 @@ +--- +# +# Handler to clean up EPEL whenever it is used +# +- name: remove_epel + shell: rpm -e epel-release + ignore_errors: true + become: true diff --git a/ansible/install/roles/epel/tasks/main.yml b/ansible/install/roles/epel/tasks/main.yml new file mode 100644 index 000000000..2c5eaee73 --- /dev/null +++ b/ansible/install/roles/epel/tasks/main.yml @@ -0,0 +1,18 @@ +--- +# +# Tasks install EPEL packages +# + +- name: Remove old EPEL + yum: name=epel-release state=absent + become: true + +- name: Import EPEL GPG Key + rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 + state=present + become: true + +- name: Check for EPEL repo + yum: "name={{ epel7_rpm }} state=present" + become: true + notify: remove_epel diff --git a/ansible/install/roles/grafana/tasks/main.yml b/ansible/install/roles/grafana/tasks/main.yml index 573095c12..23cdd32d3 100644 --- a/ansible/install/roles/grafana/tasks/main.yml +++ b/ansible/install/roles/grafana/tasks/main.yml @@ -9,14 +9,6 @@ msg="** Edit grafana_host and graphite_host in ../install/group_vars/all.yml before running **" when: ((grafana_host is none) or (graphite_host is none)) -- name: Import EPEL GPG Key - rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 - state=present - -- name: Check for EPEL repo - yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - state=present - - name: Install grafana RPM repo copy: src=grafana.repo @@ -140,9 +132,3 @@ - name: Remove leftover json file file: path={{role_path}}/files/data_source.json state=absent connection: local - -- name: Disable EPEL Repo - ini_file: dest=/etc/yum.repos.d/epel.repo - section=epel - option=enabled - value=0 diff --git a/ansible/install/roles/grafana_docker/tasks/main.yml b/ansible/install/roles/grafana_docker/tasks/main.yml index 13b49aefb..95b0de90e 100644 --- a/ansible/install/roles/grafana_docker/tasks/main.yml +++ b/ansible/install/roles/grafana_docker/tasks/main.yml @@ -3,14 +3,6 @@ # Install/run grafana-server for browbeat # -- name: Import EPEL GPG Key - rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 - state=present - -- name: Check for EPEL repo - yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - state=present - - name: disable firewalld service: name=firewalld state=stopped enabled=false become: true @@ -80,8 +72,3 @@ become: true when: systemd_grafana_needs_restart.changed -- name: Disable EPEL Repo - ini_file: dest=/etc/yum.repos.d/epel.repo - section=epel - option=enabled - value=0 diff --git a/ansible/install/roles/graphite/tasks/main.yml b/ansible/install/roles/graphite/tasks/main.yml index 5d4a1ba9a..bd9e27e79 100644 --- a/ansible/install/roles/graphite/tasks/main.yml +++ b/ansible/install/roles/graphite/tasks/main.yml @@ -3,14 +3,6 @@ # Install/run graphite-web for browbeat # -- name: Import EPEL GPG Key - rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 - state=present - -- name: Check for EPEL repo - yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - state=present - - name: Install graphite rpms yum: name={{ item }} state=present become: true @@ -168,8 +160,3 @@ become: true when: carbon_cache_needs_restart.changed -- name: Disable EPEL Repo - ini_file: dest=/etc/yum.repos.d/epel.repo - section=epel - option=enabled - value=0 diff --git a/ansible/install/roles/graphite_docker/tasks/main.yml b/ansible/install/roles/graphite_docker/tasks/main.yml index 145092775..5e58bf758 100644 --- a/ansible/install/roles/graphite_docker/tasks/main.yml +++ b/ansible/install/roles/graphite_docker/tasks/main.yml @@ -3,14 +3,6 @@ # Install/run graphite-web for browbeat # -- name: Import EPEL GPG Key - rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 - state=present - -- name: Check for EPEL repo - yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - state=present - - name: Install repo file for docker copy: src=docker.repo @@ -117,9 +109,3 @@ become: true when: systemd_carbon_needs_restart.changed - -- name: Disable EPEL Repo - ini_file: dest=/etc/yum.repos.d/epel.repo - section=epel - option=enabled - value=0 diff --git a/ansible/install/roles/nginx/tasks/main.yml b/ansible/install/roles/nginx/tasks/main.yml index bec42e52c..e8066296f 100644 --- a/ansible/install/roles/nginx/tasks/main.yml +++ b/ansible/install/roles/nginx/tasks/main.yml @@ -3,14 +3,6 @@ # Install/run nginx for browbeat # -- name: Import EPEL GPG Key - rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 - state=present - -- name: Check for EPEL repo - yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - state=present - - name: Install nginx, httpd-tools, httplib2, libsemanage-python yum: name={{ item }} state=present become: true @@ -164,8 +156,3 @@ ignore_errors: true when: iptables_needs_restart != 0 and firewalld_in_use.rc != 0 and firewalld_is_active.rc != 0 -- name: Disable EPEL Repo - ini_file: dest=/etc/yum.repos.d/epel.repo - section=epel - option=enabled - value=0