Allow deployment of Undercloud (VM) without direct access to the underlying virthost.

This commit adds a playbook (based on baremetal-undercloud) calling
a generic baremetal provisioning script to deploy a Undercloud VM.
Such script should return when the Undercloud VM is accessible via ssh.
Afterwards the playbook resumes the expected workflow of inventory generation,
repositories setup etc.

Change-Id: Iea00c2a54e10d725b2ab9ee6ce5d71c64a460c02
This commit is contained in:
Luca Miccini 2019-04-04 08:02:24 +02:00
parent 1100482ec5
commit 59335cc483
1 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,96 @@
---
- name: Provision undercloud by directly calling provisioning script
hosts: localhost
pre_tasks:
- name: Provision script execution
shell: >
set -o pipefail &&
{{ baremetal_provisioning_script }} 2>&1 | tee
"{{ local_working_dir }}/baremetal_provision.log"
when: step_provide_undercloud|bool
- name: Add the undercloud VM to the inventory
add_host:
name: "{{ undercloud_eth0_ip }}"
groups: undercloud
ansible_user: "root"
ansible_private_key_file: "{{ ansible_private_key_file_location | default('') }}"
ansible_ssh_common_args: '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
- name: Copy the private key to the expected location
copy:
src: "{{ ansible_private_key_file_location }}"
dest: "{{ local_working_dir }}/id_rsa_undercloud"
mode: 0600
- name: Inventory the undercloud
hosts: localhost
gather_facts: true
vars:
inventory: undercloud
roles:
- tripleo-inventory
- name: Setup repositories
hosts: undercloud
gather_facts: true
roles:
- repo-setup
tags:
- undercloud-repo-setup
- name: Install packages
hosts: undercloud
gather_facts: false
roles:
- baremetal-undercloud/packages
tags:
- undercloud-pkgs-install
# Small playbook with logic for when to build images or not.
# The logic there can be completely overridden by setting the
# to_build variable.
- include: to-build-or-not-to-build.yml
- name: Run DLRN gate role and install repo
hosts: undercloud
vars:
artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz"
artg_repos_dir: "{{ repo_clone_dir|default('/opt/stack/new') }}"
ib_create_web_repo: "{{ to_build|bool }}"
roles:
- {role: build-test-packages, when: build_test_packages|default(false)|bool}
- {role: install-built-repo, when: compressed_gating_repo is defined}
tags:
- build
- name: Get images for quickstart
hosts: undercloud
gather_facts: false
vars:
ib_repo_image_inject: "{{ not to_build|bool }}"
ib_repo_run_live: false
modify_image_vc_ram: 4096
modify_image_vc_cpu: 4
modify_image_vc_verbose: true
roles:
- {role: fetch-images,
when: not to_build|bool}
- {role: repo-setup,
repo_inject_image_path: "$HOME/overcloud-full.qcow2",
repo_run_live: false,
when: not to_build|bool}
- {role: repo-setup,
repo_inject_image_path: "$HOME/ironic-python-agent.initramfs",
repo_run_live: false,
initramfs_image: true,
libguestfs_mode: false,
when: not to_build|bool}
- {role: install-built-repo,
ib_repo_image_path: "$HOME/overcloud-full.qcow2",
when: compressed_gating_repo is defined and not to_build|bool}
- {role: install-built-repo,
ib_repo_image_path: "$HOME/ironic-python-agent.initramfs",
initramfs_image: true,
libguestfs_mode: false,
when: compressed_gating_repo is defined and not to_build|bool}