Customize undercloud and overcloud with virt-customize
If undercloud and/or overcloud_customize_scripts are provided, it will make customizations with virt-customize, so any extra tasks needed can be performed there. Change-Id: I882983cc60f8ddc4323da81dea0d482c2f2d2dc9
This commit is contained in:
parent
294e447e50
commit
db2ac77548
@ -134,3 +134,25 @@ You can select what to delete prior to the run of quickstart adding a
|
||||
- all: same as virthost but user setup in virthost is deleted too
|
||||
- none: will not teardown anything (useful for testing multiple actions
|
||||
against a deployed overcloud)
|
||||
|
||||
Undercloud customization
|
||||
------------------------
|
||||
|
||||
You can perform extra undercloud customization steps, using a script
|
||||
that will be applied with ``virt-customize`` on the final undercloud
|
||||
image. To allow that, you need to pass the ``undercloud_customize_script``
|
||||
var, that needs to point to an script living on your filesystem.
|
||||
That script will be copied to working directory, and applied on the
|
||||
undercloud. The script can be in Jinja template format, so you can benefit
|
||||
from ansible var substitutions.
|
||||
|
||||
Overcloud customization
|
||||
-----------------------
|
||||
|
||||
You can perform extra overclud customization steps, using a script
|
||||
that will be applied with ``virt-customize`` on the overcloud-full
|
||||
image. To allow that, you need to pass the ``overcloud_customize_script``
|
||||
var, that needs to point to an script living on your filesystem.
|
||||
That script will be copied to working directory, and applied on the
|
||||
overcloud. The script can be in Jinja template format, so you can benefit
|
||||
from ansible var substitutions.
|
||||
|
38
roles/libvirt/setup/undercloud/tasks/customize_overcloud.yml
Normal file
38
roles/libvirt/setup/undercloud/tasks/customize_overcloud.yml
Normal file
@ -0,0 +1,38 @@
|
||||
- name: Create overcloud customize script
|
||||
template:
|
||||
src: "{{ overcloud_customize_script }}"
|
||||
dest: "{{ working_dir }}/overcloud-customize.sh"
|
||||
mode: 0755
|
||||
|
||||
- environment:
|
||||
LIBGUESTFS_BACKEND: direct
|
||||
LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"
|
||||
block:
|
||||
# We need to extract the overcloud image, if it's not already extracted.
|
||||
# so we can inject the gating repo into it.
|
||||
- name: check if overcloud image is already extracted
|
||||
stat:
|
||||
path: '{{ working_dir }}/overcloud-full.qcow2'
|
||||
register: overcloud_image_stat_for_customize
|
||||
|
||||
- name: Extract overcloud-full image
|
||||
command: >
|
||||
virt-copy-out -a {{ working_dir }}/undercloud.qcow2
|
||||
/home/stack/overcloud-full.qcow2 {{ working_dir }}
|
||||
register: overcloud_image_extracted_for_customize
|
||||
when: not overcloud_image_stat_for_customize.stat.exists
|
||||
|
||||
# only customize overcloud-full image if that is not going to be
|
||||
# used as undercloud
|
||||
- name: Perform extra overcloud customizations
|
||||
command: >
|
||||
virt-customize -a {{ working_dir}}/overcloud-full.qcow2
|
||||
--run '{{ working_dir}}/overcloud-customize.sh'
|
||||
|
||||
- name: Copy updated overcloud-full image back to undercloud
|
||||
command: >
|
||||
virt-copy-in -a {{ working_dir }}/undercloud.qcow2
|
||||
{{ working_dir }}/overcloud-full.qcow2 /home/stack/
|
||||
when: overcloud_image_extracted_for_customize is defined and
|
||||
overcloud_image_extracted_for_customize|changed
|
||||
|
@ -87,6 +87,27 @@
|
||||
owner: stack
|
||||
group: stack
|
||||
|
||||
- name: Create undercloud customize script
|
||||
template:
|
||||
src: "{{ undercloud_customize_script }}"
|
||||
dest: "{{ working_dir}}/undercloud-customize.sh"
|
||||
mode: 0755
|
||||
when: undercloud_customize_script is defined
|
||||
|
||||
# This allows to run a customization script on the
|
||||
# undercloud image, to cover any extra needs.
|
||||
- name: Perform extra undercloud customizations
|
||||
command: >
|
||||
virt-customize -a {{ working_dir }}/undercloud.qcow2
|
||||
--run '{{ working_dir }}/undercloud-customize.sh'
|
||||
when: undercloud_customize_script is defined
|
||||
|
||||
# This allows to run a customization script on the
|
||||
# overcloud image, to cover any extra needs.
|
||||
- name: Perform extra overcloud customizations
|
||||
include: customize_overcloud.yml
|
||||
when: overcloud_customize_script is defined
|
||||
|
||||
# Perform an SELinux relabel on the undercloud image to avoid problems
|
||||
# caused by bad labelling, since by default the undercloud runs in
|
||||
# enforcing mode.
|
||||
|
Loading…
Reference in New Issue
Block a user