Refactor bootstrap-hwconfig
Hardware configuration is currently bootstrapped by engine
playbook and it only deals with PDF/IDF files. Heat files
are fetched by Heat itself which is more appropriate since
hardware configuration is provisioner specific and needs to be
dealt by the the provisioner rather than engine.
Apart from moving things to where they fit, this is probably
the last change that enables us to start working on generic
inventory generation as the engine and provisioners are separated
from each other, making it easier to implement necessary
changes.
This change
- removes engine bootstrap-hwconfig tasks and roles
- renames engine bootstrap-configuration playbook and role to
bootstrap-swconfig to match what we actually do, just SDF stuff
- creates a new playbook and corresponding role named bootstrap-hwconfig
for bifrost to collect PDF/IDF under config_path and symlink to
inventory/group_vars/all
- creates a new playbook and corresponding role named bootstrap-hwconfig
for heat by renaming install-configure-heat role
- creates a separate/new/simplified IDF for Heat so we completely cut
connection/reliance of Heat to regular PDF/IDF
- takes out create-stack role and converts it to its own playbook so
bootstrap-hwconfig and create-stack playbooks are run explicitly in provision.sh
- heat files are kept as is in install-configure-heat/files since
jenkins jobs still use those. jobs will be adapted once this change passes
the verifition and the folder install-configure-heat will be deleted.
Change-Id: Ia18f90e0d83511d10880c1564351be157d3bb122
diff --git a/playbooks/main.yml b/playbooks/bootstrap-hwconfig.yaml
similarity index 86%
copy from playbooks/main.yml
copy to playbooks/bootstrap-hwconfig.yaml
index f818288..f177d84 100644
--- a/playbooks/main.yml
+++ b/playbooks/bootstrap-hwconfig.yaml
@@ -3,7 +3,7 @@
# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
-# you may use this file except in compliance with the License.
+# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@@ -19,11 +19,10 @@
- hosts: localhost
connection: local
- gather_facts: true
+ gather_facts: false
become: false
roles:
- - role: install-configure-heat
- - role: create-stack
+ - role: bootstrap-hwconfig
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/main.yml b/playbooks/create-stack.yaml
similarity index 96%
rename from playbooks/main.yml
rename to playbooks/create-stack.yaml
index f818288..9d60df8 100644
--- a/playbooks/main.yml
+++ b/playbooks/create-stack.yaml
@@ -23,7 +23,6 @@
become: false
roles:
- - role: install-configure-heat
- role: create-stack
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/bootstrap-hwconfig/files/heat-environment-city-ubuntu1804.yaml b/playbooks/roles/bootstrap-hwconfig/files/heat-environment-city-ubuntu1804.yaml
new file mode 100644
index 0000000..57a9cb7
--- /dev/null
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-environment-city-ubuntu1804.yaml
@@ -0,0 +1,46 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# this is an example heat environment file and the resources are limited
+# in order to ensure using the engine without proper environment file
+# does not result in too much usage on the cloud
+parameters:
+ # parameters for jumphost
+ jumphost_image: 'Ubuntu 18.04 Bionic Beaver'
+ jumphost_flavor: 2C-4GB
+ jumphost_volume_size: 150
+
+ # parameters for master nodes
+ no_of_master_nodes: 1
+ master_image: 'Ubuntu 18.04 Bionic Beaver'
+ master_flavor: 2C-4GB
+ master_volume_size: 150
+
+ # parameters for worker nodes
+ no_of_worker_nodes: 1
+ worker_image: 'Ubuntu 18.04 Bionic Beaver'
+ worker_flavor: 2C-4GB
+ worker_volume_size: 150
+
+ # common parameters
+ public_network: ext-net
+ dns_nameservers: ['8.8.8.8', '8.8.4.4', '1.1.1.1']
+ use_tenant_network: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/bootstrap-hwconfig/files/heat-environment-xerces-ubuntu1804.yaml b/playbooks/roles/bootstrap-hwconfig/files/heat-environment-xerces-ubuntu1804.yaml
new file mode 100644
index 0000000..43c4fca
--- /dev/null
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-environment-xerces-ubuntu1804.yaml
@@ -0,0 +1,46 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# this is an example heat environment file and the resources are limited
+# in order to ensure using the engine without proper environment file
+# does not result in too much usage on the cloud
+parameters:
+ # parameters for jumphost
+ jumphost_image: 'Ubuntu 18.04'
+ jumphost_flavor: c2m4
+ jumphost_volume_size: 150
+
+ # parameters for master nodes
+ no_of_master_nodes: 1
+ master_image: 'Ubuntu 18.04'
+ master_flavor: c2m4
+ master_volume_size: 150
+
+ # parameters for worker nodes
+ no_of_worker_nodes: 1
+ worker_image: 'Ubuntu 18.04'
+ worker_flavor: c2m4
+ worker_volume_size: 150
+
+ # common parameters
+ public_network: internet
+ dns_nameservers: ['8.8.8.8', '8.8.4.4', '1.1.1.1']
+ use_tenant_network: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/bootstrap-hwconfig/files/heat-environment.yaml b/playbooks/roles/bootstrap-hwconfig/files/heat-environment.yaml
new file mode 120000
index 0000000..09c5d77
--- /dev/null
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-environment.yaml
@@ -0,0 +1 @@
+heat-environment-city-ubuntu1804.yaml
\ No newline at end of file
diff --git a/playbooks/roles/install-configure-heat/tasks/main.yml b/playbooks/roles/bootstrap-hwconfig/files/heat-idf.yaml
similarity index 72%
rename from playbooks/roles/install-configure-heat/tasks/main.yml
rename to playbooks/roles/bootstrap-hwconfig/files/heat-idf.yaml
index 1e882b0..d74c05b 100644
--- a/playbooks/roles/install-configure-heat/tasks/main.yml
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-idf.yaml
@@ -16,20 +16,24 @@
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
+idf:
+ version: 0.1
+ kubespray: &idf_kubespray
+ nodes_roles:
+ node1: [k8s-cluster, kube-master, etcd, vault]
+ node2: [k8s-cluster, kube-node]
+ groups:
+ k8s-cluster:
+ - kube-node
+ - kube-master
+ hostnames:
+ node1: master0
+ node2: node0
-- name: Copy Heat templates
- copy:
- src: "{{ item }}"
- dest: "{{ engine_cache }}/config/"
- with_items:
- - heat-template.yaml
- - heat-server.yaml
- - heat-jumphost.yaml
+engine:
+ pod_name: vpod
-- name: Get Heat environment file
- get_url:
- url: "{{ heat_env_file }}"
- dest: "{{ engine_cache }}/config/heat-environment.yaml"
- mode: 0644
+ installers:
+ kubespray: *idf_kubespray
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/bootstrap-hwconfig/files/heat-jumphost.yaml b/playbooks/roles/bootstrap-hwconfig/files/heat-jumphost.yaml
new file mode 100644
index 0000000..60906ae
--- /dev/null
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-jumphost.yaml
@@ -0,0 +1,153 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+heat_template_version: pike
+
+description: Common template for jumphost instance
+
+parameters:
+ # parameters for instances
+ instance_name:
+ type: string
+ label: Name
+ description: Instance name
+
+ image:
+ type: string
+ label: Image name or ID
+ description: Image to use for instances
+
+ volume_size:
+ type: string
+ label: Volume size
+ description: Size of the volume
+
+ flavor:
+ type: string
+ label: Flavor
+ description: Flavor to use for instances
+
+ keypair:
+ type: string
+ label: Key name
+ description: Keypair to use for instances
+
+ internal_security_group:
+ type: string
+ label: Internal Security Group
+ description: Security Group to place jumphost and cluster instances in
+
+ external_security_group:
+ type: string
+ label: External Security Group
+ description: Security Group to place jumphost in
+
+ private_network:
+ type: string
+ label: Private network name or ID
+ description: Network to attach instances to
+
+ public_network:
+ type: string
+ label: Public Network
+ description: Public network
+
+conditions:
+ skip_volume: {equals: [{get_param: volume_size}, "0"]}
+ create_volume:
+ not: skip_volume
+
+resources:
+ root_login:
+ type: OS::Heat::CloudConfig
+ properties:
+ cloud_config:
+ disable_root: false
+
+ boot_config:
+ type: OS::Heat::MultipartMime
+ properties:
+ parts:
+ - config: {get_resource: root_login}
+
+ port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: private_network}
+ replacement_policy: AUTO
+ security_groups:
+ - {get_param: internal_security_group}
+ - {get_param: external_security_group}
+
+ floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: {get_param: public_network}
+
+ floating_ip_assoc:
+ type: OS::Neutron::FloatingIPAssociation
+ properties:
+ floatingip_id: {get_resource: floating_ip}
+ port_id: {get_resource: port}
+
+ bootable_volume:
+ type: OS::Cinder::Volume
+ condition: create_volume
+ properties:
+ name:
+ list_join: ['.', ['volume', {get_param: instance_name}]]
+ size: {get_param: volume_size}
+ image: {get_param: image}
+
+ instance_with_volume:
+ type: OS::Nova::Server
+ condition: create_volume
+ properties:
+ name: {get_param: instance_name}
+ image: {get_param: image}
+ flavor: {get_param: flavor}
+ key_name: {get_param: keypair}
+ networks:
+ - port: {get_resource: port}
+ block_device_mapping:
+ - device_name: vda
+ volume_id: {get_resource: bootable_volume}
+ delete_on_termination: true
+ user_data_format: SOFTWARE_CONFIG
+ user_data: {get_resource: boot_config}
+
+ instance_without_volume:
+ type: OS::Nova::Server
+ condition: skip_volume
+ properties:
+ name: {get_param: instance_name}
+ image: {get_param: image}
+ flavor: {get_param: flavor}
+ key_name: {get_param: keypair}
+ networks:
+ - port: {get_resource: port}
+ user_data_format: SOFTWARE_CONFIG
+ user_data: {get_resource: boot_config}
+
+
+outputs:
+ instance_ip:
+ value: {get_attr: [floating_ip, floating_ip_address]}
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/bootstrap-hwconfig/files/heat-server.yaml b/playbooks/roles/bootstrap-hwconfig/files/heat-server.yaml
new file mode 100644
index 0000000..5913824
--- /dev/null
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-server.yaml
@@ -0,0 +1,165 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+heat_template_version: pike
+
+description: Common template for instances to install cluster on
+
+parameters:
+ # parameters for instances
+ instance_name:
+ type: string
+ label: Name
+ description: Instance name
+
+ image:
+ type: string
+ label: Image name or ID
+ description: Image to use for instances
+
+ volume_size:
+ type: string
+ label: Volume size
+ description: Size of the volume
+
+ flavor:
+ type: string
+ label: Flavor
+ description: Flavor to use for instances
+
+ keypair:
+ type: string
+ label: Key name
+ description: Keypair to use for instances
+
+ internal_security_group:
+ type: string
+ label: Internal Security Group
+ description: Security Group to place jumphost and cluster instances in
+
+ external_security_group:
+ type: string
+ label: External Security Group
+ default: none
+ description: Security Group to access instance from public network
+
+ public_network:
+ type: string
+ label: Public network name or ID
+ description: Public network to attach instance to
+ default: NA
+
+ private_network:
+ type: string
+ label: Private network name or ID
+ description: Private network to attach instances to
+
+ use_network:
+ type: string
+ label: Network to use
+ description: Which network to use for instance
+
+conditions:
+ skip_volume: {equals: [{get_param: volume_size}, "0"]}
+ create_volume:
+ not: skip_volume
+ use_public_network: {equals: [{get_param: use_network}, "public"]}
+ use_private_network:
+ not: use_public_network
+
+resources:
+ root_login:
+ type: OS::Heat::CloudConfig
+ properties:
+ cloud_config:
+ disable_root: false
+
+ boot_config:
+ type: OS::Heat::MultipartMime
+ properties:
+ parts:
+ - config: {get_resource: root_login}
+
+ port_private:
+ type: OS::Neutron::Port
+ condition: use_private_network
+ properties:
+ network: {get_param: private_network}
+ replacement_policy: AUTO
+ security_groups:
+ - {get_param: internal_security_group}
+
+ port_public:
+ type: OS::Neutron::Port
+ condition: use_public_network
+ properties:
+ network: {get_param: public_network}
+ replacement_policy: AUTO
+ # This has to be addressed, current combination of security group
+ # doesn't allow ingress/egress comunication to k8s api via https.
+ # Worked around by using default security group
+ # security_groups:
+ # - {get_param: internal_security_group}
+ # - {get_param: external_security_group}
+
+ bootable_volume:
+ type: OS::Cinder::Volume
+ condition: create_volume
+ properties:
+ name:
+ list_join: ['.', ['volume', {get_param: instance_name}]]
+ size: {get_param: volume_size}
+ image: {get_param: image}
+
+ instance_with_volume:
+ type: OS::Nova::Server
+ condition: create_volume
+ properties:
+ name: {get_param: instance_name}
+ image: {get_param: image}
+ flavor: {get_param: flavor}
+ key_name: {get_param: keypair}
+ networks:
+ - port: {if: [use_public_network, {get_resource: port_public}, {get_resource: port_private}]}
+ block_device_mapping:
+ - device_name: vda
+ volume_id: {get_resource: bootable_volume}
+ delete_on_termination: true
+ user_data_format: SOFTWARE_CONFIG
+ user_data: {get_resource: boot_config}
+ config_drive: true
+ instance_without_volume:
+ type: OS::Nova::Server
+ condition: skip_volume
+ properties:
+ name: {get_param: instance_name}
+ image: {get_param: image}
+ flavor: {get_param: flavor}
+ key_name: {get_param: keypair}
+ networks:
+ - port: {if: [use_public_network, {get_resource: port_public}, {get_resource: port_private}]}
+ user_data_format: SOFTWARE_CONFIG
+ user_data: {get_resource: boot_config}
+ config_drive: true
+
+outputs:
+ instance_ip:
+ value: {if: ["create_volume", {get_attr: [instance_with_volume, first_address]}, {get_attr: [instance_without_volume, first_address]}]}
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/bootstrap-hwconfig/files/heat-template.yaml b/playbooks/roles/bootstrap-hwconfig/files/heat-template.yaml
new file mode 100644
index 0000000..2af8f60
--- /dev/null
+++ b/playbooks/roles/bootstrap-hwconfig/files/heat-template.yaml
@@ -0,0 +1,262 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+heat_template_version: pike
+
+description: Kubespray cluster template to deploy ONAP
+
+parameters:
+ # parameteres for jumphost instance
+ jumphost_image:
+ type: string
+ label: Image name or ID
+ description: Image to use for jumphost instance
+
+ jumphost_flavor:
+ type: string
+ label: Flavor
+ description: Flavor to use for jumphost instance
+
+ jumphost_volume_size:
+ type: string
+ label: Volume size of the jumphost
+ description: Size of the volume
+ default: 0
+
+ # parameters for master instances
+ no_of_master_nodes:
+ type: number
+ label: No of k8s master nodes
+ description: Number of master nodes in cluster
+
+ master_image:
+ type: string
+ label: Image name or ID
+ description: Image to use for master instances
+
+ master_flavor:
+ type: string
+ label: Flavor
+ description: Flavor to use for master instances
+
+ master_volume_size:
+ type: string
+ label: Volume size of the master nodes
+ description: Size of the volume
+ default: 0
+
+ # parameters for worker instances
+ no_of_worker_nodes:
+ type: number
+ label: No of k8s worker nodes
+ description: Number of worker nodes in cluster
+
+ worker_image:
+ type: string
+ label: Image name or ID
+ description: Image to use for worker instances
+
+ worker_flavor:
+ type: string
+ label: Flavor
+ description: Flavor to use for worker instances
+
+ worker_volume_size:
+ type: string
+ label: Volume size of the worker nodes
+ description: Size of the volume
+ default: 0
+
+ # common parameters
+ keypair:
+ type: string
+ label: Key name
+ description: Keypair to use for instances
+
+ public_network:
+ type: string
+ label: Public Network
+ description: Public network
+
+ dns_nameservers:
+ type: comma_delimited_list
+ label: DNS nameservers
+ description: DNS nameservers
+
+ use_tenant_network:
+ type: boolean
+ label: Use private tenant network or not
+ description: Use private tenant network or public flat
+ default: true
+
+conditions:
+ use_private_network: {equals: [{get_param: use_tenant_network}, true]}
+
+resources:
+ # create external security group
+ external_security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ name:
+ list_join: ['.', ['external-sg', {get_param: 'OS::stack_name'}]]
+ description: |
+ Security Group to place jumphost in
+ rules: [
+ {
+ remote_ip_prefix: 0.0.0.0/0,
+ protocol: tcp,
+ port_range_min: 22,
+ port_range_max: 22
+ }
+ ]
+
+ # create internal security group
+ internal_security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ name:
+ list_join: ['.', ['internal-sg', {get_param: 'OS::stack_name'}]]
+ description: |
+ Security Group to place jumphost and cluster instances in
+ rules: [
+ {
+ remote_ip_prefix: 0.0.0.0/0,
+ direction: ingress,
+ protocol: icmp
+ }
+ ]
+
+ # create tcp security group rule for internal_security_group
+ internal_security_group_rule_tcp:
+ type: OS::Neutron::SecurityGroupRule
+ properties:
+ security_group: {get_resource: internal_security_group}
+ remote_group: {get_resource: internal_security_group}
+ direction: ingress
+ protocol: tcp
+
+ # create udp security group rule for internal_security_group
+ internal_security_group_rule_udp:
+ type: OS::Neutron::SecurityGroupRule
+ properties:
+ security_group: {get_resource: internal_security_group}
+ remote_group: {get_resource: internal_security_group}
+ direction: ingress
+ protocol: udp
+
+ # create private network subnet
+ private_network:
+ type: OS::Neutron::Net
+ properties:
+ name:
+ list_join: ['.', ['network', {get_param: 'OS::stack_name'}]]
+
+ private_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ name:
+ list_join: ['.', ['subnet', {get_param: 'OS::stack_name'}]]
+ network_id: {get_resource: private_network}
+ cidr: 10.1.0.0/24
+ dns_nameservers: {get_param: dns_nameservers}
+
+ router:
+ type: OS::Neutron::Router
+ properties:
+ name:
+ list_join: ['.', ['router', {get_param: 'OS::stack_name'}]]
+ external_gateway_info:
+ network: {get_param: public_network}
+
+ router_interface:
+ type: OS::Neutron::RouterInterface
+ properties:
+ router_id: {get_resource: router}
+ subnet: {get_resource: private_subnet}
+
+ # create jumphost
+ jumphost:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ type: heat-jumphost.yaml
+ properties:
+ instance_name:
+ list_join: ['.', ['jumphost', {get_param: 'OS::stack_name'}]]
+ image: {get_param: jumphost_image}
+ flavor: {get_param: jumphost_flavor}
+ volume_size: {get_param: jumphost_volume_size}
+ keypair: {get_param: keypair}
+ private_network: {get_resource: private_network}
+ public_network: {get_param: public_network}
+ internal_security_group: {get_resource: internal_security_group}
+ external_security_group: {get_resource: external_security_group}
+ depends_on:
+ - router_interface
+
+ # create master nodes
+ master_nodes:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: {get_param: no_of_master_nodes}
+ resource_def:
+ type: heat-server.yaml
+ properties:
+ instance_name:
+ list_join: ['.', ['master%index%', {get_param: 'OS::stack_name'}]]
+ image: {get_param: master_image}
+ flavor: {get_param: master_flavor}
+ volume_size: {get_param: master_volume_size}
+ keypair: {get_param: keypair}
+ private_network: {get_resource: private_network}
+ public_network: {get_param: public_network}
+ internal_security_group: {get_resource: internal_security_group}
+ external_security_group: {get_resource: external_security_group}
+ use_network: {if: ["use_private_network", "private", "public"]}
+
+ # create worker nodes
+ worker_nodes:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: {get_param: no_of_worker_nodes}
+ resource_def:
+ type: heat-server.yaml
+ properties:
+ instance_name:
+ list_join: ['.', ['worker%index%', {get_param: 'OS::stack_name'}]]
+ image: {get_param: worker_image}
+ flavor: {get_param: worker_flavor}
+ volume_size: {get_param: worker_volume_size}
+ keypair: {get_param: keypair}
+ private_network: {get_resource: private_network}
+ public_network: {get_param: public_network}
+ internal_security_group: {get_resource: internal_security_group}
+ external_security_group: {get_resource: external_security_group}
+ use_network: {if: ["use_private_network", "private", "public"]}
+
+
+outputs:
+ jumphost_ip:
+ value: {get_attr: [jumphost, instance_ip]}
+ master_ip:
+ value: {get_attr: [master_nodes, instance_ip]}
+ worker_ip:
+ value: {get_attr: [worker_nodes, instance_ip]}
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/install-configure-heat/tasks/main.yml b/playbooks/roles/bootstrap-hwconfig/tasks/main.yaml
similarity index 65%
copy from playbooks/roles/install-configure-heat/tasks/main.yml
copy to playbooks/roles/bootstrap-hwconfig/tasks/main.yaml
index 1e882b0..b14e1b9 100644
--- a/playbooks/roles/install-configure-heat/tasks/main.yml
+++ b/playbooks/roles/bootstrap-hwconfig/tasks/main.yaml
@@ -17,19 +17,35 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-- name: Copy Heat templates
+- name: Copy Heat templates and IDF file
copy:
src: "{{ item }}"
- dest: "{{ engine_cache }}/config/"
+ dest: "{{ config_path }}"
with_items:
- heat-template.yaml
- heat-server.yaml
- heat-jumphost.yaml
+ - heat-idf.yaml
- name: Get Heat environment file
get_url:
url: "{{ heat_env_file }}"
- dest: "{{ engine_cache }}/config/heat-environment.yaml"
+ dest: "{{ config_path }}/heat-environment.yaml"
mode: 0644
+- name: Remove existing Heat IDF symlink
+ file:
+ path: "{{ inventory_path }}/group_vars/idf.yaml"
+ state: absent
+ ignore_errors: true
+
+# NOTE: Heat IDF file is linked from config_path to inventory
+# folder in order to ensure we have single IDF
+- name: Link collected Heat IDF file to inventory folder
+ file:
+ src: "{{ config_path }}/heat-idf.yaml"
+ dest: "{{ inventory_path }}/group_vars/all/idf.yaml"
+ state: link
+ force: true
+
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/install-configure-heat/files/.remove-me b/playbooks/roles/install-configure-heat/files/.remove-me
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/playbooks/roles/install-configure-heat/files/.remove-me
diff --git a/provision.sh b/provision.sh
index 79df169..344e6d3 100755
--- a/provision.sh
+++ b/provision.sh
@@ -33,13 +33,22 @@
# shellcheck disable=SC1090
source "$OPENRC"
-# create stack using the provided Heat Template
-echo "Info: Install, configure heat and create stack"
+#-------------------------------------------------------------------------------
+# Bootstrap hwconfig
+#-------------------------------------------------------------------------------
+echo "Info: Bootstrap hardware configuration"
echo "-------------------------------------------------------------------------"
cd "${ENGINE_PATH}"
ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
-i "${ENGINE_PATH}/engine/inventory/localhost.ini" \
- "${PROVISIONER_ROOT_DIR}/playbooks/main.yml"
+ "${PROVISIONER_ROOT_DIR}/playbooks/bootstrap-hwconfig.yaml"
+
+echo "Info: Create stack using Heat"
+echo "-------------------------------------------------------------------------"
+cd "${ENGINE_PATH}"
+ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
+ -i "${ENGINE_PATH}/engine/inventory/localhost.ini" \
+ "${PROVISIONER_ROOT_DIR}/playbooks/create-stack.yaml"
echo "Info: Generate Ansible inventory"
echo "-------------------------------------------------------------------------"