Merge "Enable TLS configuration for containerized Galera"
[apex-tripleo-heat-templates.git] / common / deploy-steps-tasks.yaml
1     # Note the indentation here is required as it's joined
2     # to create a playbook in deploy-steps.j2
3    
4     #####################################################
5     # Per step puppet configuration of the baremetal host
6     #####################################################
7     - name: Write the config_step hieradata
8       copy: content="{{dict(step=step|int)|to_json}}" dest=/etc/puppet/hieradata/config_step.json force=true
9     - name: Run puppet host configuration for step {{step}}
10       command: >-
11         puppet apply
12         --modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
13         --logdest syslog --logdest console --color=false
14         /var/lib/tripleo-config/puppet_step_config.pp
15       changed_when: false
16       check_mode: no
17       register: outputs
18       failed_when: false
19       no_log: true
20     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
21       when: outputs is defined
22       failed_when: outputs|failed
23     ######################################
24     # Generate config via docker-puppet.py
25     ######################################
26     - name: Run docker-puppet tasks (generate config)
27       shell: python /var/lib/docker-puppet/docker-puppet.py
28       environment:
29         NET_HOST: 'true'
30         DEBUG: '{{docker_puppet_debug|default(false)}}'
31       when: step == "1"
32       changed_when: false
33       check_mode: no
34       register: outputs
35       failed_when: false
36       no_log: true
37     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
38       when: outputs is defined
39       failed_when: outputs|failed
40     ##################################################
41     # Per step starting of the containers using paunch
42     ##################################################
43     - name: Check if /var/lib/hashed-tripleo-config/docker-container-startup-config-step_{{step}}.json exists
44       stat:
45         path: /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
46       register: docker_config_json
47     # Note docker-puppet.py generates the hashed-*.json file, which is a copy of
48     # the *step_n.json with a hash of the generated external config added
49     # This acts as a salt to enable restarting the container if config changes
50     - name: Start containers for step {{step}}
51       command: >-
52         paunch --debug apply
53         --file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
54         --config-id tripleo_step{{step}} --managed-by tripleo-{{role_name}}
55       when: docker_config_json.stat.exists
56       changed_when: false
57       check_mode: no
58       register: outputs
59       failed_when: false
60       no_log: true
61     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
62       when: outputs is defined
63       failed_when: outputs|failed
64     ########################################################
65     # Bootstrap tasks, only performed on bootstrap_server_id
66     ########################################################
67     - name: Check if /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json exists
68       stat:
69         path: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
70       register: docker_puppet_tasks_json
71     - name: Run docker-puppet tasks (bootstrap tasks)
72       shell: python /var/lib/docker-puppet/docker-puppet.py
73       environment:
74         CONFIG: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
75         NET_HOST: "true"
76         NO_ARCHIVE: "true"
77         STEP: "{{step}}"
78       when: deploy_server_id == bootstrap_server_id and docker_puppet_tasks_json.stat.exists
79       changed_when: false
80       check_mode: no
81       register: outputs
82       failed_when: false
83       no_log: true
84     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
85       when: outputs is defined
86       failed_when: outputs|failed