Cleanup and move files for overcloud-prep-images
This commit is contained in:
48
roles/overcloud-prep-images/README.md
Normal file
48
roles/overcloud-prep-images/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
An Ansible role to copy configuration files to the undercloud prior to deployment.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
This playbook expects that the undercloud has been installed and setup using one of the roles relevant to baremetal overcloud deployments.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
**Note:** Make sure to include all environment file and options from your [initial Overcloud creation](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Scaling_the_Overcloud.html).
|
||||
|
||||
- working_dir: <'/home/stack'> -- working directory for the role. Assumes stackrc file is present at this location
|
||||
- baremetal_instackenv: <"{{ working_dir }}/instackenv.json"> -- location of instackenv.json to copy over
|
||||
- baremetal_network_environment: <"{{ working_dir }}/network-isolation.yml"> -- location of network-environment file to copy over
|
||||
- undercloud_type: <virtual> -- can be overwritten with values like 'baremetal' or 'ovb'
|
||||
- step_root_device_size: <false> -- add disk size hints if needed for the environment under test
|
||||
- disk_root_device_size: <1843> -- size hint for selecting the correct disk during introspection
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
This playbook does not deploy the overcloud. After this playbook runs, call https://github.com/redhat-openstack/ansible-role-tripleo-overcloud.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
1. Sample playbook to call the role
|
||||
|
||||
- name: Copy configuration files
|
||||
hosts: virthost
|
||||
gather_facts: no
|
||||
roles:
|
||||
- ansible-role-tripleo-overcloud-prep-config
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache 2.0
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
RDO-CI Team
|
||||
|
||||
11
roles/overcloud-prep-images/defaults/main.yml
Normal file
11
roles/overcloud-prep-images/defaults/main.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
overcloud_prep_images_script: overcloud-prep-images.sh.j2
|
||||
overcloud_prep_images_log: "{{ working_dir }}/overcloud_prep_images.log"
|
||||
|
||||
step_overcloud_image: true
|
||||
step_glance_upload: false
|
||||
step_register: true
|
||||
step_introspect: false
|
||||
bash_deploy_ramdisk: false
|
||||
step_install_undercloud: true
|
||||
step_root_device_size: false
|
||||
disk_root_device_size: 1843
|
||||
3
roles/overcloud-prep-images/meta/main.yml
Normal file
3
roles/overcloud-prep-images/meta/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
dependencies:
|
||||
- libvirt
|
||||
- tripleo
|
||||
7
roles/overcloud-prep-images/tasks/create-scripts.yml
Normal file
7
roles/overcloud-prep-images/tasks/create-scripts.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
# Create the scripts that will be used to setup the overcloud images
|
||||
|
||||
- name: Create overcloud prep-images script
|
||||
template:
|
||||
src: "{{ overcloud_prep_images_script }}"
|
||||
dest: "{{ working_dir }}/overcloud-prep-images.sh"
|
||||
mode: 0755
|
||||
7
roles/overcloud-prep-images/tasks/main.yml
Normal file
7
roles/overcloud-prep-images/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- include: create-scripts.yml
|
||||
tags:
|
||||
- undercloud-scripts
|
||||
|
||||
- include: overcloud-prep-images.yml
|
||||
tags:
|
||||
- undercloud-post-install
|
||||
@@ -0,0 +1,4 @@
|
||||
- name: Prepare the overcloud images for deploy
|
||||
shell: |
|
||||
{{ working_dir }}/overcloud-prep-images.sh > \
|
||||
{{ overcloud_prep_images_log }} 2>&1
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
### --start_docs
|
||||
## Prepare images for deploying the overcloud
|
||||
## ==================================================
|
||||
|
||||
## Prepare Your Environment
|
||||
## ------------------------
|
||||
|
||||
## * Source in the undercloud credentials.
|
||||
## ::
|
||||
|
||||
source {{ working_dir }}/stackrc
|
||||
|
||||
{% if step_overcloud_image|bool %}
|
||||
|
||||
## * Upload images to glance.
|
||||
## ::
|
||||
|
||||
openstack overcloud image upload {% if bash_deploy_ramdisk %}--old-deploy-image{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if step_glance_upload|bool %}
|
||||
|
||||
## * Upload images to glance, this step is specific to nodepool based deployments.
|
||||
## ::
|
||||
|
||||
glance image-create --container-format bare --disk-format qcow2 --name overcloud-full --file overcloud-full.qcow2
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
## note:: Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1391602
|
||||
## ::
|
||||
|
||||
sudo systemctl restart openstack-ironic-conductor && sleep 30
|
||||
|
||||
{% if step_register|bool %}
|
||||
|
||||
## * Register nodes with Ironic.
|
||||
## ::
|
||||
|
||||
openstack baremetal import --json instackenv.json
|
||||
openstack baremetal configure boot
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if step_root_device_size|bool %}
|
||||
|
||||
## * Get nodes UUID
|
||||
## ::
|
||||
|
||||
export items="$( ironic node-list | awk '/power/ {print $2}' )"
|
||||
|
||||
## * Find disk size from instackenv.json
|
||||
## ::
|
||||
|
||||
export DISK_SIZE="$( jq '.["nodes"][]["disk"] | tonumber' instackenv.json )"
|
||||
|
||||
## * Update nodes with disk size hint
|
||||
## ::
|
||||
|
||||
count=0
|
||||
ARRAY_DISK_SIZE=($(echo $DISK_SIZE))
|
||||
ROOT_DEVICE_SIZE={{ disk_root_device_size }}
|
||||
for item in $items; do
|
||||
if [ $ROOT_DEVICE_SIZE -ge ${ARRAY_DISK_SIZE[$count]} ]; then
|
||||
declare i ADS
|
||||
ADS=${ARRAY_DISK_SIZE[$count]}
|
||||
ironic node-update $item add properties/root_device='{"size": '$ADS'}'
|
||||
fi
|
||||
count=$((count+1))
|
||||
done
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if step_introspect %}
|
||||
|
||||
## * Introspect hardware attributes of nodes.
|
||||
## ::
|
||||
|
||||
openstack baremetal introspection bulk start
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
### --stop_docs
|
||||
Reference in New Issue
Block a user