diff options
author | Tomas Sedovic <tomas@sedovic.cz> | 2017-11-07 14:17:27 +1100 |
---|---|---|
committer | Tomas Sedovic <tomas@sedovic.cz> | 2017-11-07 14:17:27 +1100 |
commit | 6f4d509817f200ec2a273a097f4f048da5997925 (patch) | |
tree | ebddc919d850ec5c4d308613661063b01ae89784 /roles/openstack-stack/tasks | |
parent | 0cf8cf65a89ad7cac8c1cef1f743426b610adae0 (diff) | |
parent | 332f131e8e6457a03a4f1ab19abc8e4ceb897307 (diff) | |
download | openshift-6f4d509817f200ec2a273a097f4f048da5997925.tar.gz openshift-6f4d509817f200ec2a273a097f4f048da5997925.tar.bz2 openshift-6f4d509817f200ec2a273a097f4f048da5997925.tar.xz openshift-6f4d509817f200ec2a273a097f4f048da5997925.zip |
Merge ../openshift-ansible-contrib into openstack-provider-githist
This moves all the OpenStack-related code from the -contrib[1] repo
including its git history to openshift-ansible. It will then be moved
around and updated to fit the rest of the project's structure.
[1]: https://github.com/openshift/openshift-ansible-contrib
Diffstat (limited to 'roles/openstack-stack/tasks')
-rw-r--r-- | roles/openstack-stack/tasks/cleanup.yml | 6 | ||||
-rw-r--r-- | roles/openstack-stack/tasks/generate-templates.yml | 26 | ||||
-rw-r--r-- | roles/openstack-stack/tasks/main.yml | 27 | ||||
-rw-r--r-- | roles/openstack-stack/tasks/subnet_update_dns_servers.yaml | 9 |
4 files changed, 68 insertions, 0 deletions
diff --git a/roles/openstack-stack/tasks/cleanup.yml b/roles/openstack-stack/tasks/cleanup.yml new file mode 100644 index 000000000..258334a6b --- /dev/null +++ b/roles/openstack-stack/tasks/cleanup.yml @@ -0,0 +1,6 @@ +--- + +- name: cleanup temp files + file: + path: "{{ stack_template_pre.path }}" + state: absent diff --git a/roles/openstack-stack/tasks/generate-templates.yml b/roles/openstack-stack/tasks/generate-templates.yml new file mode 100644 index 000000000..0ff50a095 --- /dev/null +++ b/roles/openstack-stack/tasks/generate-templates.yml @@ -0,0 +1,26 @@ +--- +- name: create HOT stack template prefix + register: stack_template_pre + tempfile: + state: directory + prefix: openshift-ansible + +- name: set template paths + set_fact: + stack_template_path: "{{ stack_template_pre.path }}/stack.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: "{{ stack_template_pre.path }}/server.yaml" + +- name: generate user_data from jinja2 template + template: + src: user_data.j2 + dest: "{{ user_data_template_path }}" diff --git a/roles/openstack-stack/tasks/main.yml b/roles/openstack-stack/tasks/main.yml new file mode 100644 index 000000000..983567026 --- /dev/null +++ b/roles/openstack-stack/tasks/main.yml @@ -0,0 +1,27 @@ +--- + +- name: Generate the templates + include: generate-templates.yml + when: + - stack_state == 'present' + +- name: Handle the Stack (create/delete) + ignore_errors: False + register: stack_create + os_stack: + name: "{{ stack_name }}" + state: "{{ stack_state }}" + template: "{{ stack_template_path | default(omit) }}" + wait: yes + +# NOTE(bogdando) OS::Neutron::Subnet doesn't support live updates for +# dns_nameservers, so we can't do that for the "create stack" task. +- include: subnet_update_dns_servers.yaml + when: + - private_dns_server is defined + - stack_state == 'present' + +- name: CleanUp + include: cleanup.yml + when: + - stack_state == 'present' diff --git a/roles/openstack-stack/tasks/subnet_update_dns_servers.yaml b/roles/openstack-stack/tasks/subnet_update_dns_servers.yaml new file mode 100644 index 000000000..af28fc98f --- /dev/null +++ b/roles/openstack-stack/tasks/subnet_update_dns_servers.yaml @@ -0,0 +1,9 @@ +--- +- name: Live update the subnet's DNS servers + os_subnet: + name: openshift-ansible-{{ stack_name }}-subnet + network_name: openshift-ansible-{{ stack_name }}-net + state: present + use_default_subnetpool: yes + dns_nameservers: "{{ [private_dns_server|default(public_dns_nameservers[0])]|union(public_dns_nameservers)|unique }}" + when: not provider_network |