Use ansible for NetworkConfig
Use ansible to apply the NetworkConfig resource instead of the NetworkDeployment resource. The script module is used to run the same rendered script as NetworkDeployment. In the future the script could be refactored into a more proper ansible role, but the first step is to remove the SoftwareDeployment for NetworkConfig and just use an ansible task. Change-Id: Ie60ddb90562f9630c24711337473f9e3acdcf4c1 Depends-On: Ie543782569de14d56bc41740611f7512e8357a22 implements: blueprint reduce-deployment-resources
This commit is contained in:
parent
ec68f1740c
commit
0cd9b72541
@ -140,6 +140,13 @@ parameters:
|
||||
default: ''
|
||||
description: A map of role name to a space separated list of IP addresses used to ping test each available network interface.
|
||||
type: json
|
||||
StackAction:
|
||||
type: string
|
||||
description: >
|
||||
Heat action on performed top-level stack. Note StackUpdateType is
|
||||
set to UPGRADE when a major-version upgrade is in progress.
|
||||
constraints:
|
||||
- allowed_values: ['CREATE', 'UPDATE']
|
||||
|
||||
conditions:
|
||||
{% for role in enabled_roles %}
|
||||
@ -287,6 +294,7 @@ outputs:
|
||||
validate_fqdn: {get_param: ValidateFqdn}
|
||||
validate_ntp: {get_param: ValidateNtp}
|
||||
ping_test_ips: {get_param: PingTestIpsMap}
|
||||
stack_action: {get_param: StackAction}
|
||||
common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml}
|
||||
docker_puppet_script: {get_file: ./container-puppet.py}
|
||||
all_nodes_validation_script.sh : {get_file: ../validation-scripts/all-nodes.sh}
|
||||
@ -408,6 +416,64 @@ outputs:
|
||||
force: false
|
||||
with_items: "{{ '{{' }} lookup('vars', tripleo_role_name + '_pre_deployments')|default([]) {{ '}}' }}"
|
||||
|
||||
- name: Check for previous run of NetworkConfig
|
||||
stat:
|
||||
path: /var/lib/tripleo-config/os-net-config.returncode
|
||||
register: os_net_config_returncode_stat
|
||||
|
||||
- name: Check result of previous run of NetworkConfig
|
||||
slurp:
|
||||
path: /var/lib/tripleo-config/os-net-config.returncode
|
||||
when: os_net_config_returncode_stat.stat.exists
|
||||
register: os_net_config_returncode_slurp
|
||||
|
||||
- name: NetworkConfig
|
||||
block:
|
||||
- name: Create /var/lib/tripleo-config/scripts directory
|
||||
file:
|
||||
path: /var/lib/tripleo-config/scripts
|
||||
state: directory
|
||||
setype: svirt_sandbox_file_t
|
||||
selevel: s0
|
||||
recurse: true
|
||||
|
||||
- name: Copy NetworkConfig script
|
||||
copy:
|
||||
dest: /var/lib/tripleo-config/scripts/run_os_net_config.sh
|
||||
src: {{ '"{{' }} tripleo_role_name ~ '/' ~ inventory_hostname ~ '/NetworkConfig' {{ '}}"' }}
|
||||
mode: 0755
|
||||
|
||||
- name: Run NetworkConfig script
|
||||
command: /var/lib/tripleo-config/scripts/run_os_net_config.sh
|
||||
async: {{ '"{{' }} async_timeout | default(300) {{ '}}"' }}
|
||||
poll: {{ '"{{' }} async_poll | default(3) {{ '}}"' }}
|
||||
environment:
|
||||
bridge_name: {{ '"{{' }} neutron_physical_bridge_name {{ '}}"' }}
|
||||
interface_name: {{ '"{{' }} neutron_public_interface_name {{ '}}"' }}
|
||||
register: NetworkConfig_result
|
||||
failed_when: false
|
||||
|
||||
- name: Write rc of NetworkConfig script
|
||||
copy:
|
||||
content: {{ '"{{' }} NetworkConfig_result.rc {{ '}}"' }}
|
||||
dest: /var/lib/tripleo-config/os-net-config.returncode
|
||||
|
||||
- name: NetworkConfig stdout
|
||||
debug:
|
||||
var: NetworkConfig_result.stderr_lines
|
||||
failed_when: NetworkConfig_result.rc != 0
|
||||
|
||||
# The conditions here are when we want to apply the
|
||||
# NetworkConfig. They are:
|
||||
# - If the stack_action is CREATE
|
||||
# - Or UPDATE is in the network_deployment_actions
|
||||
# - Or the previous run of NetworkConfig failed.
|
||||
# This will match the prior behavior of when a Heat
|
||||
# SoftwareDeployment was used.
|
||||
when: (stack_action == "CREATE") or ("UPDATE" in network_deployment_actions) or
|
||||
(os_net_config_returncode_stat.stat.exists and
|
||||
((os_net_config_returncode_slurp.content | b64decode) != 0))
|
||||
|
||||
- name: AllNodesValidationConfig
|
||||
script: all_nodes_validation_script.sh
|
||||
environment:
|
||||
|
@ -655,28 +655,18 @@ resources:
|
||||
ServiceNames: {get_param: ServiceNames}
|
||||
deployment_actions: {get_attr: [DeploymentActions, value]}
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
NetworkDeploymentActionsValue:
|
||||
type: OS::Heat::Value
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
server: {get_resource: {{server_resource_name}}}
|
||||
input_values:
|
||||
bridge_name: {get_param: NeutronPhysicalBridge}
|
||||
interface_name: {get_param: NeutronPublicInterface}
|
||||
actions:
|
||||
if:
|
||||
- server_not_blacklisted
|
||||
- if:
|
||||
- role_network_deployment_actions_exists
|
||||
- {get_param: {{role.name}}NetworkDeploymentActions}
|
||||
- {get_param: NetworkDeploymentActions}
|
||||
- []
|
||||
value:
|
||||
- if:
|
||||
- role_network_deployment_actions_exists
|
||||
- {get_param: {{role.name}}NetworkDeploymentActions}
|
||||
- {get_param: NetworkDeploymentActions}
|
||||
|
||||
{{server_resource_name}}Deployment:
|
||||
type: OS::Heat::StructuredDeployment
|
||||
depends_on: NetworkDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: {{server_resource_name}}Deployment
|
||||
config: {get_resource: {{server_resource_name}}Config}
|
||||
@ -742,7 +732,7 @@ resources:
|
||||
|
||||
# Resource for site-specific injection of root certificate
|
||||
NodeTLSCAData:
|
||||
depends_on: NetworkDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
type: OS::TripleO::NodeTLSCAData
|
||||
properties:
|
||||
server: {get_resource: {{server_resource_name}}}
|
||||
@ -947,3 +937,6 @@ outputs:
|
||||
value:
|
||||
any_errors_fatal: {get_param: {{role.name}}AnyErrorsFatal}
|
||||
max_fail_percentage: {get_param: {{role.name}}MaxFailPercentage}
|
||||
neutron_physical_bridge_name: {get_param: NeutronPhysicalBridge}
|
||||
neutron_public_interface_name: {get_param: NeutronPublicInterface}
|
||||
network_deployment_actions: {get_attr: [NetworkDeploymentActionsValue, value]}
|
||||
|
Loading…
Reference in New Issue
Block a user