Merge "Add EDPM role and playbook for standalone-compute deployment"

This commit is contained in:
Zuul 2022-10-20 15:10:18 +00:00 committed by Gerrit Code Review
commit 8c9860311a
11 changed files with 232 additions and 0 deletions

View File

@ -0,0 +1,34 @@
---
# This playbook does:
# - On undercloud node
# + it bootstrap the node and deploy standalone
# + Generate 99 standalone vars and copy it to
# subnode-1
#
- hosts: undercloud
gather_facts: true
tags:
- standalone
vars:
deploy_standalone: true
tasks:
- name: Run External Data Plane management role
include_role:
name: external-data-plane-management
# On subnode-1
# It bootstrap the node and install required packages
# copy 99 standalone vars to tripleo inventory
# Deploy compute services
- hosts: subnode-1
gather_facts: true
tags:
- standalone
vars:
deploy_standalone: false
copy_inventory: true
target_host: subnode-1
tasks:
- name: Run External Data Plane management role
include_role:
name: external-data-plane-management

View File

@ -0,0 +1,14 @@
External Data Plane Management
==============================
An Ansible role to deploy standalone compute.
Example Playbook
----------------
1. Sample playbook to call the role
- name: Deploy the compute node
include_role:
name: external-data-plane-management

View File

@ -0,0 +1,31 @@
---
# Containers images used in deployment
tripleo_iscsid_image: "{{ docker_registry_host }}/{{ docker_registry_namespace }}/openstack-iscsid:{{ docker_image_tag }}"
tripleo_logrotate_crond_image: "{{ docker_registry_host }}/{{ docker_registry_namespace }}/openstack-cron:{{ docker_image_tag }}"
tripleo_nova_compute_container_image: "{{ docker_registry_host }}/{{ docker_registry_namespace }}/openstack-nova-compute:{{ docker_image_tag }}"
tripleo_nova_libvirt_container_image: "{{ docker_registry_host }}/{{ docker_registry_namespace }}/openstack-nova-libvirt:{{ docker_image_tag }}"
tripleo_ovn_controller_image: "{{ docker_registry_host }}/{{ docker_registry_namespace }}/openstack-ovn-controller:{{ docker_image_tag }}"
deploy_standalone: false
# tripleo-standalone-vars script related vars
tripleo_standalone_vars: "/home/{{ ansible_user }}/src/opendev.org/openstack/tripleo-ansible/scripts/tripleo-standalone-vars"
config_download_dir: "/home/{{ ansible_user }}/tripleo-deploy"
role_type: "Standalone"
copy_inventory: false
target_host: undercloud
# Vars required for compute service deployment
tripleo_network_config_template: templates/ci/multinode.j2
neutron_public_interface_name: eth0
tripleo_selinux_mode: permissive
tripleo_hosts_entries_overcloud_hosts_entries:
- 192.168.24.1 standalone.ctlplane.localdomain standalone.ctlplane
ctlplane_ip: 192.168.24.1
# Vars needed when allinone compute deployment is done
ctlplane_dns_nameservers:
- 127.0.0.1
- 1.1.1.1
dns_search_domains: []
tripleo_ovn_dbs:
- 192.168.24.1

View File

@ -0,0 +1,3 @@
---
dependencies:
- extras-common

View File

@ -0,0 +1,61 @@
---
# It contains following tasks:
# - Set hostname for target node
# - Run repo-setup role to enable specific release files
# - Build depends-on changes using build-test-packages and enable gating repo
# to install built packages from gating repo
# - Install tripleo-ansible and its required dependencies
# - Copy standalone env vars to subnode-1
# - Change localhost to target hostname
# - Deploy compute services.
- name: Install Required packages
become: true
package:
name:
- ansible-collection-containers-podman
- python3-tenacity
- tripleo-ansible
- ansible-role-chrony
state: present
- name: Copy 99 standalone var from controller to compute node
copy:
src: "/home/{{ ansible_user }}/99-standalone-vars"
dest: "/usr/share/ansible/tripleo-inventory/99-standalone-vars"
become: true
when: copy_inventory | default('false') | bool
- name: Change localhost name to target host
become: true
lineinfile:
path: "/usr/share/ansible/tripleo-inventory/02-computes"
search_string: 'localhost:'
# 4 spaces is added to place at proper hostname position
# TODO(chkumar): Explore inifile module to manipulate yaml
# file later.
line: " {{ target_host }}:"
- name: Rename the host_vars file to target host
become: true
copy:
src: "/usr/share/ansible/tripleo-inventory/host_vars/localhost"
dest: "/usr/share/ansible/tripleo-inventory/host_vars/{{ target_host }}"
- name: Remove the old file
become: true
file:
path: "/usr/share/ansible/tripleo-inventory/host_vars/localhost"
state: absent
- name: Generate deploy_compute.sh script
template:
src: deploy_compute.sh.j2
dest: "{{ working_dir }}/deploy_compute.sh"
mode: 0755
- name: Run deploy_compute.sh script
shell: >
set -o pipefail &&
{{ working_dir }}/deploy_compute.sh
2>&1 > {{ working_dir }}/deploy_compute.log

View File

@ -0,0 +1,6 @@
---
- name: Deploy Standalone
include_role:
name: standalone
- import_tasks: generate_tripleo_standalone_vars.yml

View File

@ -0,0 +1,20 @@
---
# Playbook to generate Tripleo Standalone var file
- name: Find config_download directory
find:
path: "{{ config_download_dir }}"
patterns: 'standalone-ansible-*'
recurse: false
file_type: directory
register: dir_path
- name: set fact for config_download_dir path
set_fact:
config_download_path: "{{ dir_path.files[0].path }}"
- name: Generate Tripleo Standalone var file
shell: |
python3 {{ tripleo_standalone_vars }} -c {{ config_download_path }} \
-r {{ role_type }}
args:
chdir: "/home/{{ ansible_user }}"

View File

@ -0,0 +1,10 @@
---
- name: Install Required packages
become: true
package:
name:
- ansible-collection-containers-podman
- python3-tenacity
- tripleo-ansible
- ansible-role-chrony
state: present

View File

@ -0,0 +1,24 @@
---
# This Playbook does the following things in order
# prepare_node.yml
# * It will run on both controller and compute node.
# - Add the host to tripleo-inventory
# - Run undercloud-setup
- import_tasks: prepare_node.yml
# deploy_standalone.yml
# * It will run on controller node
# - Deploy Standalone
# - Generate 99 standalone vars
- import_tasks: deploy_standalone.yml
when: deploy_standalone | bool
# compute_services_on_target_host.yml
# * It will run on target node.
# - Install the tripleo-ansible dependencies on target node
# - Copy 99 standalone vars from controller to
# compute node inventory
# - Deploy compute services on target node
- import_tasks: compute_services_on_target_host.yml
when: not deploy_standalone | bool

View File

@ -0,0 +1,11 @@
---
# A set of tasks for bootstrapping the node
- name: Add the nodes to the generated inventory
vars:
inventory: multinode
include_role:
name: tripleo-inventory
- name: Prepare the node for installation
include_role:
name: undercloud-setup

View File

@ -0,0 +1,18 @@
sudo ansible-playbook -i /usr/share/ansible/tripleo-inventory \
-e tripleo_iscsid_image={{ tripleo_iscsid_image }} \
-e tripleo_logrotate_crond_image={{ tripleo_logrotate_crond_image }} \
-e tripleo_nova_compute_container_image={{ tripleo_nova_compute_container_image }} \
-e tripleo_nova_libvirt_container_image={{ tripleo_nova_libvirt_container_image }} \
-e tripleo_ovn_controller_image={{ tripleo_ovn_controller_image }} \
-e tripleo_selinux_mode={{ tripleo_selinux_mode }} \
-e neutron_public_interface_name={{ neutron_public_interface_name }} \
-e tripleo_network_config_template={{ tripleo_network_config_template }} \
-e '{ctlplane_dns_nameservers: {{ ctlplane_dns_nameservers }}}' \
-e '{tripleo_hosts_entries_overcloud_hosts_entries: {{ tripleo_hosts_entries_overcloud_hosts_entries|to_json }}}' \
{% if not copy_inventory | bool %}
-e '{dns_search_domains: {{ dns_search_domains }}}' \
-e '{tripleo_ovn_dbs: {{ tripleo_ovn_dbs }}}' \
{% else %}
-e ctlplane_ip={{ ctlplane_ip }} \
{% endif %}
/usr/share/ansible/tripleo-playbooks/deploy-overcloud-compute.yml