From a53b69524ba2b3ea42fa5624cc256446b75fa6db Mon Sep 17 00:00:00 2001 From: Will Foster Date: Tue, 12 Apr 2016 15:23:59 +0100 Subject: [PATCH] switch to yum Ansible module when possible for repo management. Change-Id: I53682eee2a9146a7b142deb34fd8ae7ea2244b0a --- .../roles/collectd-generic/tasks/main.yml | 20 +++++++------------ .../roles/collectd-openstack/tasks/main.yml | 20 +++++++------------ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/ansible/install/roles/collectd-generic/tasks/main.yml b/ansible/install/roles/collectd-generic/tasks/main.yml index 8713d2926..790e898e0 100644 --- a/ansible/install/roles/collectd-generic/tasks/main.yml +++ b/ansible/install/roles/collectd-generic/tasks/main.yml @@ -3,15 +3,8 @@ # Install/run collectd for browbeat (Generic) # -- name: Check for epel - shell: rpm -qa | grep -q epel-release - ignore_errors: true - register: epel_installed - -- name: Install epel repo - command: rpm -ivh {{ epel_repo }} - become: true - when: epel_installed.rc != 0 +- name: Check for EPEL repo + yum: name=epel-release state=present - name: Install collectd rpms yum: name={{ item }} state=present @@ -121,7 +114,8 @@ service: name=collectd state=restarted enabled=true become: true -- name: Disable EPEL - shell: rpm -e epel-release - ignore_errors: true - become: true +- 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/collectd-openstack/tasks/main.yml b/ansible/install/roles/collectd-openstack/tasks/main.yml index 9ac612c45..aa6bf2cee 100644 --- a/ansible/install/roles/collectd-openstack/tasks/main.yml +++ b/ansible/install/roles/collectd-openstack/tasks/main.yml @@ -3,15 +3,8 @@ # Install/run collectd for browbeat # -- name: Check for epel - shell: rpm -qa | grep -q epel-release - ignore_errors: true - register: epel_installed - -- name: Install epel repo - command: rpm -ivh {{ epel_repo }} - become: true - when: epel_installed.rc != 0 +- name: Check for EPEL repo + yum: name=epel-release state=present - name: Install collectd rpms yum: name={{ item }} state=present @@ -85,7 +78,8 @@ service: name=collectd state=restarted enabled=true become: true -- name: Disable EPEL - shell: rpm -e epel-release - ignore_errors: true - become: true +- name: Disable EPEL Repo + ini_file: dest=/etc/yum.repos.d/epel.repo + section=epel + option=enabled + value=0