summaryrefslogtreecommitdiffstats
path: root/roles/openstack-stack/tasks/main.yml
blob: 9b4855294fb98837cc4d0285a26c3b3a169c9dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- 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"
    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 HOT server w/o floating IPs template from jinja2 template
  template:
    src: heat_stack_server_nofloating.yaml.j2
    dest: "{{ stack_template_pre.path }}/server_nofloating.yaml"
  when: use_bastion|bool

- 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: "{{ stack_template_path }}"
    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

- name: cleanup temp files
  file:
    path: "{{ stack_template_pre.path }}"
    state: absent