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