df50e75f10
The OVB role was written at first to work with ready undercloud images. This review changes the workflow to use a vanilla guest image for the undercloud and set up the users, repos and overcloud images after the OVB stack is deployed. This streamlines the OVB workflow on different environments. Change-Id: Ic8f40b5e38fab5aee3dc84d6fb1462b3f0f61ca7
133 lines
4.1 KiB
YAML
133 lines
4.1 KiB
YAML
---
|
|
- name: Ensure local working dir exists
|
|
file:
|
|
path: "{{ local_working_dir }}"
|
|
|
|
- name: generate prefix for all run-related entities
|
|
set_fact:
|
|
prefix="{{ tmp.node_prefix }}"
|
|
|
|
- name: set fact for undercloud image
|
|
set_fact: latest_undercloud_image="{{ latest_guest_image[osp_release | default(release)] }}"
|
|
|
|
- name: copy key inserted in image to undercloud_key location
|
|
copy:
|
|
src: "{{ existing_key_location }}/{{ item }}"
|
|
dest: "{{ local_working_dir }}/{{ item }}"
|
|
mode: 0600
|
|
with_items:
|
|
- id_rsa_undercloud
|
|
- id_rsa_undercloud.pub
|
|
|
|
- name: Copy deploy stack parameters template
|
|
template:
|
|
src: env.yaml.j2
|
|
dest: "{{ local_working_dir }}/{{ prefix }}env.yaml"
|
|
mode: 0755
|
|
|
|
- name: Add templates for multi-nic
|
|
blockinfile:
|
|
dest: "{{ local_working_dir }}/{{ prefix }}env.yaml"
|
|
insertafter: "## in baremetal-networks-all.yaml"
|
|
content: |
|
|
## multi-nic
|
|
OS::OVB::BaremetalNetworks: {{ templates_dir }}/baremetal-networks-all.yaml
|
|
OS::OVB::BaremetalPorts: {{ templates_dir }}/baremetal-ports-all.yaml
|
|
when: network_isolation_type == 'multi-nic'
|
|
|
|
- name: Add templates for public-bond
|
|
blockinfile:
|
|
dest: "{{ local_working_dir }}/{{ prefix }}env.yaml"
|
|
insertafter: "## in baremetal-networks-all.yaml"
|
|
content: |
|
|
## public-bond
|
|
OS::OVB::BaremetalNetworks: {{ templates_dir }}/baremetal-networks-all.yaml
|
|
OS::OVB::BaremetalPorts: {{ templates_dir }}/baremetal-ports-public-bond.yaml
|
|
when: network_isolation_type == 'public-bond'
|
|
|
|
- name: Add keypair
|
|
shell: >
|
|
export OS_USERNAME="{{ os_username }}";
|
|
export OS_PASSWORD="{{ os_password }}";
|
|
export OS_TENANT_NAME="{{ os_tenant_name }}";
|
|
export OS_AUTH_URL="{{ os_auth_url }}";
|
|
nova keypair-add --pub-key ~/.ssh/id_rsa.pub {{ prefix }}key
|
|
ignore_errors: true
|
|
no_log: true
|
|
|
|
- name: copy clouds.yaml file
|
|
template:
|
|
src: clouds.yaml.j2
|
|
dest: "{{ local_working_dir }}/clouds.yaml"
|
|
mode: 0755
|
|
|
|
- name: Deploy stack
|
|
os_stack:
|
|
name: "{{ stack_name }}"
|
|
cloud: "{{ cloud_name}}"
|
|
state: present
|
|
template: "{{ heat_template }}"
|
|
environment: "{{ environment_list }}"
|
|
register: stack_deployment
|
|
environment:
|
|
OS_CLIENT_CONFIG_FILE: "{{ local_working_dir }}/clouds.yaml"
|
|
ignore_errors: true
|
|
|
|
- name: Show stack deployment information
|
|
shell: >
|
|
export OS_USERNAME="{{ os_username }}";
|
|
export OS_PASSWORD="{{ os_password }}";
|
|
export OS_TENANT_NAME="{{ os_tenant_name }}";
|
|
export OS_AUTH_URL="{{ os_auth_url }}";
|
|
heat stack-show {{ stack_name }}
|
|
when: stack_deployment.result is not defined
|
|
no_log: true
|
|
|
|
- name: set fact for undercloud floating IP address
|
|
set_fact:
|
|
undercloud_ip="{{ stack_deployment.stack.outputs[0].output_value }}"
|
|
|
|
- name: Add provisioned undercloud host
|
|
add_host:
|
|
name: undercloud
|
|
hostname: "{{ undercloud_ip }}"
|
|
groups: "{{ node_groups| join(',') }}"
|
|
ansible_host: "{{ undercloud_ip }}"
|
|
ansible_fqdn: undercloud
|
|
ansible_user: "{{ ansible_user }}"
|
|
ansible_private_key_file: "{{ undercloud_key }}"
|
|
ansible_ssh_extra_args: "{{ ssh_extra_args }}"
|
|
undercloud_ip: "{{ undercloud_ip }}"
|
|
|
|
- name: Wait for provisioned host to become reachable
|
|
command:
|
|
ssh -o BatchMode=yes -o "StrictHostKeyChecking=no" root@{{ undercloud_ip }} -i "{{ undercloud_key }}"
|
|
register: result
|
|
until: result|success
|
|
retries: 300
|
|
delay: 5
|
|
|
|
- name: Build nodes.json file to be used as instackenv.json
|
|
shell: >
|
|
chdir={{ local_working_dir }}
|
|
export OS_USERNAME="{{ os_username }}";
|
|
export OS_PASSWORD="{{ os_password }}";
|
|
export OS_TENANT_NAME="{{ os_tenant_name }}";
|
|
export OS_AUTH_URL="{{ os_auth_url }}";
|
|
{{ ovb_dir }}/bin/build-nodes-json --env {{ local_working_dir }}/{{ prefix }}env.yaml
|
|
register: nodes_json
|
|
no_log: true
|
|
|
|
- name: Ensure directories exist for network-environment copy
|
|
file:
|
|
path: "{{ network_env_file_dest }}"
|
|
state: directory
|
|
mode: 0755
|
|
|
|
- name: Copy the network-environment.yaml
|
|
copy:
|
|
src: "{{ network_environment_file }}"
|
|
dest: "{{ network_env_file_dest }}"
|
|
mode: 0755
|
|
|