summaryrefslogtreecommitdiffstats
path: root/roles/openstack-stack/tasks
diff options
context:
space:
mode:
authorEric Sauer <etsauer@gmail.com>2017-04-25 23:17:38 -0400
committerAndrew Block <andy.block@gmail.com>2017-04-25 22:17:38 -0500
commitc90d5323afc575246df2f50e9125069f3c12e81e (patch)
treeda8a02d8ab81cee2c71f89516ce558f8c36e6302 /roles/openstack-stack/tasks
parente012fccc5b402b319fec7f0a0558993ee39a39f1 (diff)
downloadopenshift-c90d5323afc575246df2f50e9125069f3c12e81e.tar.gz
openshift-c90d5323afc575246df2f50e9125069f3c12e81e.tar.bz2
openshift-c90d5323afc575246df2f50e9125069f3c12e81e.tar.xz
openshift-c90d5323afc575246df2f50e9125069f3c12e81e.zip
Stack refactor (#38)
* Refactored openstack-stack role to: - Convert static heat template files to ansible templates - Include native ansible groups via openstack metadata. This removes the need for a playbook to map host groups - Some code cleanup * Deleting commentd out code and irrelevant plays * Refactored openstack-stack role to: - Convert static heat template files to ansible templates - Include native ansible groups via openstack metadata. This removes the need for a playbook to map host groups - Some code cleanup * Deleting commentd out code and irrelevant plays * Replacing stack parameters with jinja expressions * Updating sample inventory to work with latest dynamic inventory changes * updating inventory with host group mapping. making sync keys optional * Missing cluster_hosts group * Updating to add infra_hosts * Updating inventory per comments from oybed and sabre1041
Diffstat (limited to 'roles/openstack-stack/tasks')
-rw-r--r--roles/openstack-stack/tasks/main.yml59
1 files changed, 33 insertions, 26 deletions
diff --git a/roles/openstack-stack/tasks/main.yml b/roles/openstack-stack/tasks/main.yml
index efee08c0e..71c7bbe0d 100644
--- a/roles/openstack-stack/tasks/main.yml
+++ b/roles/openstack-stack/tasks/main.yml
@@ -1,34 +1,41 @@
---
+- name: create HOT stack template prefix
+ register: stack_template_pre
+ tempfile:
+ state: directory
+ prefix: casl-ansible
+
+- name: set template paths
+ set_fact:
+ stack_template_path: "{{ stack_template_pre.path }}/stack.yaml"
+ server_template_path: "{{ stack_template_pre.path }}/server.yaml"
+ user_data_template_path: "{{ stack_template_pre.path }}/user-data"
+
+- name: generate HOT stack template from jinja2 template
+ template:
+ src: heat_stack.yaml.j2
+ dest: "{{ stack_template_path }}"
+
+- name: generate HOT server template from jinja2 template
+ template:
+ src: heat_stack_server.yaml.j2
+ dest: "{{ server_template_path }}"
+
+- name: generate user_data from jinja2 template
+ template:
+ src: user_data.j2
+ dest: "{{ user_data_template_path }}"
+
- name: create stack
ignore_errors: False
register: stack_create
os_stack:
name: "{{ stack_name }}"
state: present
- template: 'roles/openstack-stack/files/heat_stack.yaml'
+ template: "{{ stack_template_path }}"
wait: yes
- parameters:
- cluster_env: "{{ dns_domain }}"
- cluster_id: "{{ stack_name }}"
- subnet_24_prefix: "{{ subnet_prefix }}"
- dns_nameservers: "{{ dns_nameservers }}"
- external_net: "{{ external_network }}"
- ssh_public_key: "{{ ssh_public_key }}"
- num_etcd: "{{ num_etcd }}"
- num_masters: "{{ num_masters }}"
- num_nodes: "{{ num_nodes }}"
- num_infra: "{{ num_infra }}"
- num_dns: "{{ num_dns }}"
- etcd_image: "{{ openstack_image }}"
- master_image: "{{ openstack_image }}"
- node_image: "{{ openstack_image }}"
- infra_image: "{{ openstack_image }}"
- dns_image: "{{ openstack_image }}"
- etcd_flavor: "{{ etcd_flavor }}"
- master_flavor: "{{ master_flavor }}"
- node_flavor: "{{ node_flavor }}"
- infra_flavor: "{{ infra_flavor }}"
- dns_flavor: "{{ dns_flavor }}"
- master_volume_size: "{{ master_volume_size }}"
- app_volume_size: "{{ app_volume_size }}"
- infra_volume_size: "{{ infra_volume_size }}"
+
+- name: cleanup temp files
+ file:
+ path: "{{ stack_template_pre.path }}"
+ state: absent