Merge "ANSIBLE Bootstrap changes for System Controller"
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# SYSTEM PROPERTIES
|
||||
# =================
|
||||
system_mode: simplex
|
||||
# configure distributed cloud role, valid values are 'none' and 'systemcontroller'
|
||||
distributed_cloud_role: none
|
||||
timezone: UTC
|
||||
|
||||
# At least one DNS server is required and maximum 3 servers are allowed
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
with_items:
|
||||
- "prev_system_mode: {{ system_mode }}"
|
||||
- "prev_timezone: {{ timezone }}"
|
||||
- "prev_distributed_cloud_role: {{ distributed_cloud_role }}"
|
||||
- "prev_dynamic_address_allocation: {{ dynamic_address_allocation }}"
|
||||
- "prev_pxeboot_subnet: {{ pxeboot_subnet }}"
|
||||
- "prev_management_subnet: {{ management_subnet }}"
|
||||
|
||||
@@ -80,12 +80,16 @@ def populate_system_config(client):
|
||||
'sdn_enabled': False,
|
||||
'https_enabled': False}
|
||||
|
||||
dc_role = CONF.get('BOOTSTRAP_CONFIG', 'DISTRIBUTED_CLOUD_ROLE')
|
||||
if dc_role == 'none':
|
||||
dc_role = None
|
||||
values = {
|
||||
'system_mode': CONF.get('BOOTSTRAP_CONFIG', 'SYSTEM_MODE'),
|
||||
'capabilities': capabilities,
|
||||
'timezone': CONF.get('BOOTSTRAP_CONFIG', 'TIMEZONE'),
|
||||
'region_name': 'RegionOne',
|
||||
'service_project_name': 'services'
|
||||
'service_project_name': 'services',
|
||||
'distributed_cloud_role': dc_role
|
||||
}
|
||||
|
||||
if INITIAL_POPULATION:
|
||||
|
||||
@@ -214,6 +214,19 @@
|
||||
- sw_version={{ software_version }}
|
||||
- vswitch_type=none
|
||||
|
||||
- name: Ensure distributed cloud role is removed from platform.conf
|
||||
lineinfile:
|
||||
path: /etc/platform/platform.conf
|
||||
regexp: '^distributed_cloud_role'
|
||||
state: absent
|
||||
when: distributed_cloud_role == 'none'
|
||||
|
||||
- name: Add distributed cloud role to platform.conf
|
||||
lineinfile:
|
||||
path: /etc/platform/platform.conf
|
||||
line: distributed_cloud_role={{ distributed_cloud_role }}
|
||||
when: distributed_cloud_role != 'none'
|
||||
|
||||
- name: Update resolv.conf with list of dns servers
|
||||
lineinfile:
|
||||
path: /etc/resolv.conf
|
||||
|
||||
@@ -48,6 +48,12 @@
|
||||
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
|
||||
@@ -79,6 +85,14 @@
|
||||
timeout: 360
|
||||
msg: Timeout waiting for service endpoints reconfiguration to complete
|
||||
|
||||
- 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'
|
||||
|
||||
- name: Set flag to mark the initial db population completed milestone
|
||||
file:
|
||||
path: "{{ initial_db_populated_flag }}"
|
||||
|
||||
@@ -215,6 +215,7 @@
|
||||
use_unified_registry: false
|
||||
restart_services: false
|
||||
reconfigure_endpoints: false
|
||||
dc_role_changed: false
|
||||
|
||||
# Replay related flags
|
||||
last_config_file_exists: false
|
||||
@@ -366,7 +367,8 @@
|
||||
system_config_update: true
|
||||
when: (prev_system_mode != system_mode) or
|
||||
(prev_timezone != timezone) or
|
||||
(prev_dns_servers.split(',') | sort != dns_servers | sort)
|
||||
(prev_dns_servers.split(',') | sort != dns_servers | sort) or
|
||||
(prev_distributed_cloud_role != distributed_cloud_role)
|
||||
|
||||
- name: Convert previous docker no proxy config value for comparison
|
||||
set_fact:
|
||||
@@ -395,6 +397,13 @@
|
||||
(prev_external_oam_node_0_address != external_oam_node_0_address) or
|
||||
(prev_external_oam_node_1_address != external_oam_node_1_address)
|
||||
|
||||
- name: Turn on service endpoints reconfiguration flag if distributed_cloud_role is changed
|
||||
set_fact:
|
||||
reconfigure_endpoints: true
|
||||
dc_role_changed: true
|
||||
when: distributed_cloud_role == 'systemcontroller' and
|
||||
prev_distributed_cloud_role != distributed_cloud_role
|
||||
|
||||
- name: Turn on network reconfiguration flag if any of the network related config is changed
|
||||
set_fact:
|
||||
network_config_update: true
|
||||
@@ -535,6 +544,7 @@
|
||||
save_config_to_db flag: {{ save_config_to_db }},
|
||||
skip_play flag: {{ skip_play }},
|
||||
incomplete_bootstrap flag: {{ incomplete_bootstrap }},
|
||||
initial_db_populated_flag: {{ initial_db_populated }}
|
||||
initial_db_populated_flag: {{ initial_db_populated }},
|
||||
dc_role_changed_flag: {{ dc_role_changed }}
|
||||
|
||||
when: not skip_play
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
msg:
|
||||
- System mode is {{ system_mode }}
|
||||
- Timezone is {{ timezone }}
|
||||
- Distributed Cloud Role is {{ distributed_cloud_role }}
|
||||
- DNS servers is {{ dns_servers }}
|
||||
- PXE boot subnet is {{ pxeboot_subnet }}
|
||||
- Management subnet is {{ management_subnet }}
|
||||
@@ -50,6 +51,20 @@
|
||||
system_mode != 'duplex-direct') and
|
||||
(system_type == 'All-in-one')
|
||||
|
||||
- name: Validate distributed cloud role
|
||||
fail:
|
||||
msg: "Invalid distributed cloud role. Valid values are: none or systemcontroller."
|
||||
when: >
|
||||
(distributed_cloud_role != 'none' and
|
||||
distributed_cloud_role != 'systemcontroller')
|
||||
|
||||
- name: Validate system type if distributed cloud role is system controller
|
||||
fail:
|
||||
msg: "An All-in-one controller cannot be configured as Distributed Cloud System Controller"
|
||||
when: >
|
||||
(distributed_cloud_role == 'systemcontroller' and
|
||||
system_type == 'All-in-one')
|
||||
|
||||
- name: Checking registered timezones
|
||||
stat:
|
||||
path: "{{ '/usr/share/zoneinfo/' + timezone }}"
|
||||
@@ -165,6 +180,16 @@
|
||||
msg: "dynamic_address_allocation is misconfigured. Valid value is either 'True' or 'False'."
|
||||
when: not dynamic_address_allocation | type_debug == 'bool'
|
||||
|
||||
- name: Fail if management start or end address is not configured for System Controller
|
||||
fail:
|
||||
msg: >-
|
||||
management_start_address and management_end_address are required
|
||||
for System Controller as this configuration requires address space
|
||||
left for gateway address(es).
|
||||
when: >
|
||||
(distributed_cloud_role == 'systemcontroller' and
|
||||
(management_start_address == 'derived' or management_end_address == 'derived'))
|
||||
|
||||
# The provided subnets have passed validation, set the default addresses
|
||||
# based on the subnet values
|
||||
- name: Set default start and end addresses based on provided subnets
|
||||
@@ -479,6 +504,7 @@
|
||||
- "SYSTEM_TYPE={{ system_type }}"
|
||||
- "SYSTEM_MODE={{ system_mode }}"
|
||||
- "TIMEZONE={{ timezone }}"
|
||||
- "DISTRIBUTED_CLOUD_ROLE={{ distributed_cloud_role }}"
|
||||
- "SW_VERSION={{ software_version }}"
|
||||
- "NAMESERVERS={{ dns_servers| join(',') }}"
|
||||
- "PXEBOOT_SUBNET={{ pxeboot_subnet }}"
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
elif range.size < {{ min_8_addresses|int }}:
|
||||
raise Exception("Failed validation, {{ network }} address range must contain at least %d addresses." %
|
||||
int("{{ min_8_addresses }}"))
|
||||
if ("{{ distributed_cloud_role }}" == 'systemcontroller' and "{{ network }}" == 'management' and
|
||||
range.size >= (subnet.size - 2)):
|
||||
raise Exception("Failed validation, {{ network }} address range too large, no addresses left for "
|
||||
"System Controller gateway(s)")
|
||||
shell: "{{ script_content }}"
|
||||
args:
|
||||
executable: /usr/bin/python
|
||||
|
||||
Reference in New Issue
Block a user