Allow user-defined extra distro packages
This change allows the deployer to specify lists of distro packages which will be installed in addition to those specified by this role. Rather than simply concatenate the lists of installed packages, extra tasks are added to make the install ordering be as follows: * install initial packages for repo/gpg keys * configure repos * install user defined extra packages It is possible to install packages from the newly configured repos, as the user defined package list is installed last. Change-Id: I86e541e0c7d38460c697807c4f6ae5b6e7310a15
This commit is contained in:
parent
f140a2e565
commit
a72e8b9aac
|
@ -123,9 +123,15 @@ openstack_kernel_options:
|
|||
# above.
|
||||
openstack_user_kernel_options: []
|
||||
|
||||
# User defined list of extra packages to install on all hosts and containers
|
||||
openstack_host_extra_distro_packages: []
|
||||
|
||||
# Overridable set of packages to install on all hosts and containers.
|
||||
openstack_host_distro_packages: "{{ _openstack_host_distro_packages }}"
|
||||
|
||||
# User defined list of extra packages to install on the host
|
||||
openstack_host_extra_metal_distro_packages: []
|
||||
|
||||
# Overridable set of packages to install on the host.
|
||||
openstack_host_metal_distro_packages: "{{ _openstack_host_metal_distro_packages }}"
|
||||
|
||||
|
|
|
@ -27,7 +27,18 @@
|
|||
name: "{{ openstack_host_metal_distro_packages }}"
|
||||
state: "{{ openstack_hosts_package_state }}"
|
||||
register: install_packages
|
||||
until: install_packages is success
|
||||
until: install_packages is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Install user defined extra distro packages for bare metal nodes
|
||||
package:
|
||||
name: "{{ openstack_host_extra_metal_distro_packages }}"
|
||||
state: "{{ openstack_hosts_package_state }}"
|
||||
when:
|
||||
- openstack_host_extra_metal_distro_packages | length > 0
|
||||
register: install_packages
|
||||
until: install_packages is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
|
|
|
@ -80,6 +80,17 @@
|
|||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Install user defined extra distro packages
|
||||
package:
|
||||
name: "{{ openstack_host_extra_distro_packages }}"
|
||||
state: "{{ openstack_hosts_package_state }}"
|
||||
when:
|
||||
- openstack_host_extra_distro_packages | length > 0
|
||||
register: install_packages
|
||||
until: install_packages is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- include_tasks: openstack_authorized_keys.yml
|
||||
tags:
|
||||
- openstack_hosts-config
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
---
|
||||
|
||||
extra_host_package: iotop
|
||||
extra_metal_package: lshw
|
||||
|
||||
openstack_host_extra_distro_packages:
|
||||
- "{{ extra_host_package }}"
|
||||
|
||||
openstack_host_extra_metal_distro_packages:
|
||||
- "{{ extra_metal_package }}"
|
||||
|
||||
openstack_host_specific_kernel_modules:
|
||||
- name: "ebtables"
|
||||
pattern: "CONFIG_BRIDGE_NF_EBTABLES"
|
||||
|
|
|
@ -35,6 +35,16 @@
|
|||
when:
|
||||
- "'idempotence' not in lookup('env', 'ANSIBLE_LOG_PATH')"
|
||||
|
||||
- name: Ensure extra host packages are not present
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- "{{ extra_host_package }}"
|
||||
- "{{ extra_metal_package }}"
|
||||
when:
|
||||
- "'idempotence' not in lookup('env', 'ANSIBLE_LOG_PATH')"
|
||||
|
||||
# Prepare the user ssh keys
|
||||
- import_playbook: common/test-prepare-keys.yml
|
||||
|
||||
|
@ -53,36 +63,56 @@
|
|||
slurp:
|
||||
src: "{{ openstack_host_module_file }}"
|
||||
register: modules_file
|
||||
|
||||
- name: Open sysctl file
|
||||
slurp:
|
||||
src: /etc/sysctl.conf
|
||||
register: sysctl_file
|
||||
|
||||
- name: Open hosts file
|
||||
slurp:
|
||||
src: /etc/hosts
|
||||
register: hosts_file
|
||||
|
||||
- name: Open /etc/environment file
|
||||
slurp:
|
||||
src: /etc/environment
|
||||
register: environment_file
|
||||
|
||||
- name: Read files
|
||||
set_fact:
|
||||
modules_content: "{{ modules_file.content | b64decode }}"
|
||||
sysctl_content: "{{ sysctl_file.content | b64decode }}"
|
||||
hosts_content: "{{ hosts_file.content | b64decode }}"
|
||||
environment_content: "{{ environment_file.content | b64decode }}"
|
||||
|
||||
- name: Check for release file
|
||||
stat:
|
||||
path: /etc/openstack-release
|
||||
register: release_file
|
||||
|
||||
- name: Check for systat file
|
||||
stat:
|
||||
path: "{{ openstack_host_sysstat_file }}"
|
||||
register: systat_file
|
||||
|
||||
- name: Check for ssh dir
|
||||
stat:
|
||||
path: "{{ ansible_env.HOME}}/.ssh"
|
||||
register: ssh_dir
|
||||
|
||||
- name: Check for extra host package present on host
|
||||
package:
|
||||
name: "{{ extra_host_package }}"
|
||||
state: present
|
||||
register: extra_distro_package_host
|
||||
|
||||
- name: Check for extra metal package present on host
|
||||
package:
|
||||
name: "{{ extra_metal_package }}"
|
||||
state: present
|
||||
register: extra_metal_distro_package_host
|
||||
|
||||
- name: Check role functions
|
||||
assert:
|
||||
that:
|
||||
|
@ -99,3 +129,6 @@
|
|||
- "systat_file.stat.exists"
|
||||
- "'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' in environment_content"
|
||||
- "ssh_dir.stat.isdir"
|
||||
- extra_distro_package_host.changed == false
|
||||
- extra_metal_distro_package_host.changed == false
|
||||
|
||||
|
|
Loading…
Reference in New Issue