From 4f861760ce28342656bd3b4bdff59dd089f4b51b Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Tue, 13 Feb 2018 16:03:54 -0600 Subject: [PATCH] Allow deployers to configure yum fastestmirror This patch uses the new ``openstack_hosts_enable_yum_fastestmirror`` variable to determine whether yum's fastestmirror plugin should be enabled. Depends-On: I8b2a1db084ab47962dbef8c6b037836f44b4ed46 Change-Id: Id340ac48a551081031b14804d376e6e5d744fa0d --- defaults/main.yml | 3 +++ ...stestmirror-configurable-08e075f8602164e5.yaml | 7 +++++++ tasks/openstack_hosts_configure_yum.yml | 15 +++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 releasenotes/notes/fastestmirror-configurable-08e075f8602164e5.yaml diff --git a/defaults/main.yml b/defaults/main.yml index b5ad7498..747347f6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -147,3 +147,6 @@ opensuse_obs_cloud_repo_url: "{{ opensuse_mirror_obs }}/repositories/Cloud:/Open # Keep a history of systemd journals on disk after reboots openstack_host_keep_journals: yes + +# Enable/Disable the yum fastestmirror plugin +openstack_hosts_enable_yum_fastestmirror: yes diff --git a/releasenotes/notes/fastestmirror-configurable-08e075f8602164e5.yaml b/releasenotes/notes/fastestmirror-configurable-08e075f8602164e5.yaml new file mode 100644 index 00000000..a21d37af --- /dev/null +++ b/releasenotes/notes/fastestmirror-configurable-08e075f8602164e5.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Deployers of CentOS 7 environments can use the + ``openstack_hosts_enable_yum_fastestmirror`` variable to enable or disable + yum's fastestmirror plugin. The default setting of ``yes`` ensures that + fastestmirror is enabled. diff --git a/tasks/openstack_hosts_configure_yum.yml b/tasks/openstack_hosts_configure_yum.yml index 2c10a190..73e524b4 100644 --- a/tasks/openstack_hosts_configure_yum.yml +++ b/tasks/openstack_hosts_configure_yum.yml @@ -13,6 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Check to see if yum's fastestmirror plugin is present + stat: + path: /etc/yum/pluginconf.d/fastestmirror.conf + register: fastestmirror_plugin_check + +- name: Configure yum's fastestmirror plugin + ini_file: + path: /etc/yum/pluginconf.d/fastestmirror.conf + section: main + option: enabled + value: "{{ (openstack_hosts_enable_yum_fastestmirror | bool) | ternary('1', '0') }}" + no_extra_spaces: yes + when: + - fastestmirror_plugin_check.stat.exists + - name: Disable requiretty for root sudo on centos template: dest: /etc/sudoers.d/openstack-ansible