122 lines
4.0 KiB
YAML
122 lines
4.0 KiB
YAML
---
|
|
#
|
|
# Copyright (c) 2019 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# SUB-TASKS DESCRIPTION:
|
|
# Persist new configuration data in sysinv database.
|
|
#
|
|
- name: Set input parameters to populate config script
|
|
set_fact:
|
|
script_input: "{{ config_permdir + '/' + bootstrap_config_file|basename }}"
|
|
|
|
- block:
|
|
- block: # executed if config output file exists
|
|
- name: Update input parameters with reconfigure system flag
|
|
set_fact:
|
|
script_input: "{{ script_input + ' --system' }}"
|
|
when: system_config_update
|
|
|
|
- name: Update input parameters with reconfigure network flag
|
|
set_fact:
|
|
script_input: "{{ script_input + ' --network' }}"
|
|
when: network_config_update
|
|
|
|
- name: Update input parameters with reconfigure service flag
|
|
set_fact:
|
|
script_input: "{{ script_input + ' --service' }}"
|
|
# It is possible that the services failed to be brought up due to previous
|
|
# docker configuration and that setting has not been written to the output
|
|
# file.
|
|
when: docker_config_update or incomplete_bootstrap
|
|
when: last_config_file_exists
|
|
|
|
- name: Update input parameters if config from previous play has not been generated or is missing
|
|
set_fact:
|
|
script_input: "{{ script_input + ' --system --network --service' }}"
|
|
reconfigure_endpoints: true
|
|
when: not last_config_file_exists
|
|
when: initial_db_populated
|
|
|
|
- debug: var=script_input
|
|
|
|
- block:
|
|
- name: Remove the endpoint reconfig flag before reconfiguring the service endpoints
|
|
file:
|
|
path: /etc/platform/.service_endpoint_reconfigured
|
|
state: absent
|
|
when: reconfigure_endpoints
|
|
|
|
- name: Remove the system controller database config flag before reconfigure role
|
|
file:
|
|
path: /etc/platform/.sc_database_configured
|
|
state: absent
|
|
when: dc_role_changed
|
|
|
|
# Make sure the management floating address is available
|
|
- name: Add the management floating address
|
|
command: ip addr add {{ mgmt_floating_virtual }} dev lo scope host
|
|
register: add_mgmt_address
|
|
failed_when: (add_mgmt_address.rc != 0) and
|
|
(not incomplete_bootstrap) and
|
|
(mgmt_floating_virtual != prev_mgmt_floating_virtual)
|
|
when: (not replayed) or (not initial_db_populated) or (reconfigure_endpoints)
|
|
|
|
- name: Saving config in sysinv database
|
|
script: populate_initial_config.py {{ script_input }}
|
|
register: populate_result
|
|
failed_when: false
|
|
|
|
- debug: var=populate_result
|
|
|
|
- name: Fail if populate config script throws an exception
|
|
fail:
|
|
msg: "Failed to provision initial system configuration."
|
|
when: populate_result.rc != 0
|
|
|
|
# If this is initial play or replay with management and/or oam network
|
|
# config change, must wait for the keystone endpoint runtime manifest
|
|
# to complete
|
|
- name: Wait for service endpoints reconfiguration to complete
|
|
wait_for:
|
|
path: /etc/platform/.service_endpoint_reconfigured
|
|
state: present
|
|
timeout: 450
|
|
msg: Timeout waiting for service endpoints reconfiguration to complete
|
|
|
|
- name: Restart barbican
|
|
systemd:
|
|
state: restarted
|
|
name: openstack-barbican-api
|
|
|
|
- name: Wait for system controller database configuration to complete
|
|
wait_for:
|
|
path: /etc/platform/.sc_database_configured
|
|
state: present
|
|
timeout: 300
|
|
msg: Timeout waiting for system controller database configuration to complete
|
|
when: distributed_cloud_role == 'systemcontroller'
|
|
|
|
- block:
|
|
- name: Update sysinv with new region name
|
|
replace:
|
|
path: /etc/sysinv/sysinv.conf
|
|
regexp: "region_name=.*$"
|
|
replace: "region_name={{ region_name }}"
|
|
|
|
- name: Restart sysinv-agent and sysinv-api to pick up sysinv.conf update
|
|
command: "{{ item }}"
|
|
with_items:
|
|
- /etc/init.d/sysinv-agent restart
|
|
- /usr/lib/ocf/resource.d/platform/sysinv-api reload
|
|
environment:
|
|
OCF_ROOT: "/usr/lib/ocf"
|
|
when: distributed_cloud_role == 'subcloud'
|
|
|
|
- name: Set flag to mark the initial db population completed milestone
|
|
file:
|
|
path: "{{ initial_db_populated_flag }}"
|
|
state: touch
|
|
when: not initial_db_populated
|