From f732a8390adece4d9e9bffbea4654e37b2e54f72 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 18 Jul 2019 11:30:00 -0400 Subject: [PATCH] Use ansible vars nic config Migrates the NetworkConfig resource to use ansible vars as the values for Heat parameters for the IP and subnet cidr. This makes it so that the nic config template value coming out of Heat is generic per role. The same nic config can then be used for any node of that role type by Ansible, and the Ansible vars will be resolved at config-download runtime. Change-Id: I7e85dabd42ccb348ea27825d03c08157222956a1 --- puppet/role.role.j2.yaml | 4 ++-- .../notes/nic-config-ansible-vars-1943a9f2dcab5477.yaml | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/nic-config-ansible-vars-1943a9f2dcab5477.yaml diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index bfef138689..14d65d14d5 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -506,7 +506,7 @@ resources: NetworkConfig: type: OS::TripleO::{{role.name}}::Net::SoftwareConfig properties: - ControlPlaneIp: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} + ControlPlaneIp: "{{ '{{' }} ctlplane_ip {{ '}}' }}" ControlPlaneSubnetCidr: if: - ctlplane_subnet_cidr_set @@ -539,7 +539,7 @@ resources: {%- for network in networks %} {%- if network.enabled|default(true) and network.name in role.networks|default([]) %} - {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]} + {{network.name}}IpSubnet: "{{ '{{' }} {{network.name_lower}}_ip ~ '/' ~ {{network.name_lower}}_cidr {{ '}}' }}" {{network.name}}InterfaceRoutes: if: - {{network.name_lower}}_interface_routes_set diff --git a/releasenotes/notes/nic-config-ansible-vars-1943a9f2dcab5477.yaml b/releasenotes/notes/nic-config-ansible-vars-1943a9f2dcab5477.yaml new file mode 100644 index 0000000000..eaf4912798 --- /dev/null +++ b/releasenotes/notes/nic-config-ansible-vars-1943a9f2dcab5477.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The NetworkConfig resource now passes in ansible vars as the values for the + IP parameters to the nic config templates. This enables the nic config + template to be rendered generic per role coming out of Heat by + config-download. The templates can then be reused by any node of that same + role type.