Ability to add extra package manager configuration

This change implements openstack_hosts_package_manager_extra_conf variable which allows to add extra content into package manager's configuration(works with apt,yum and dnf).

Change-Id: Icbd3350c11bd0698bffc2083215ad51af759d5ef
This commit is contained in:
Damian Dabrowski 2021-04-02 14:14:43 +02:00
parent b4a2fb0b1a
commit 853114ea28
5 changed files with 34 additions and 0 deletions

View File

@ -174,3 +174,6 @@ openstack_host_ca_certificates: []
# target directory for user supplied CA certificates
openstack_host_ca_location: "{{ _openstack_host_ca_location }}"
# extra configuration for OS package manager
openstack_hosts_package_manager_extra_conf: ''

View File

@ -0,0 +1,6 @@
---
features:
- |
Implemented ``openstack_hosts_package_manager_extra_conf`` variable.
It allows to add extra content into package manager's configuration
(works with apt,yum and dnf).

View File

@ -73,6 +73,13 @@
loop_var: repo
register: _adding_apt_repo
- name: Add apt extra conf
copy:
content: "{{ openstack_hosts_package_manager_extra_conf }}"
dest: /etc/apt/apt.conf.d/99openstack-ansible
when:
- openstack_hosts_package_manager_extra_conf | length > 0
- name: Update Apt cache
apt:
update_cache: yes

View File

@ -90,6 +90,15 @@
retries: 5
delay: 2
- name: Add dnf extra conf
blockinfile:
block: "{{ openstack_hosts_package_manager_extra_conf }}"
path: /etc/dnf/dnf.conf
marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK"
create: yes
when:
- openstack_hosts_package_manager_extra_conf | length > 0
- name: Add rdo repositories via url
get_url:
url: "{{ openstack_hosts_rdo_repo_url }}/delorean.repo"

View File

@ -89,3 +89,12 @@
until: _adding_repo is success
retries: 5
delay: 2
- name: Add yum extra conf
blockinfile:
block: "{{ openstack_hosts_package_manager_extra_conf }}"
path: /etc/yum.conf
marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK"
create: yes
when:
- openstack_hosts_package_manager_extra_conf | length > 0