Remove hard-coded image reference
[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         PROCESS_COUNT: '{{docker_puppet_process_count|default(3)}}'
32       when: step == "1"
33       changed_when: false
34       check_mode: no
35       register: outputs
36       failed_when: false
37       no_log: true
38     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
39       when: outputs is defined
40       failed_when: outputs|failed
41     ##################################################
42     # Per step starting of the containers using paunch
43     ##################################################
44     - name: Check if /var/lib/hashed-tripleo-config/docker-container-startup-config-step_{{step}}.json exists
45       stat:
46         path: /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
47       register: docker_config_json
48     # Note docker-puppet.py generates the hashed-*.json file, which is a copy of
49     # the *step_n.json with a hash of the generated external config added
50     # This acts as a salt to enable restarting the container if config changes
51     - name: Start containers for step {{step}}
52       command: >-
53         paunch --debug apply
54         --file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
55         --config-id tripleo_step{{step}} --managed-by tripleo-{{role_name}}
56       when: docker_config_json.stat.exists
57       changed_when: false
58       check_mode: no
59       register: outputs
60       failed_when: false
61       no_log: true
62     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
63       when: outputs is defined
64       failed_when: outputs|failed
65     ########################################################
66     # Bootstrap tasks, only performed on bootstrap_server_id
67     ########################################################
68     - name: Check if /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json exists
69       stat:
70         path: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
71       register: docker_puppet_tasks_json
72     - name: Run docker-puppet tasks (bootstrap tasks)
73       shell: python /var/lib/docker-puppet/docker-puppet.py
74       environment:
75         CONFIG: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
76         NET_HOST: "true"
77         NO_ARCHIVE: "true"
78         STEP: "{{step}}"
79       when: deploy_server_id == bootstrap_server_id and docker_puppet_tasks_json.stat.exists
80       changed_when: false
81       check_mode: no
82       register: outputs
83       failed_when: false
84       no_log: true
85     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
86       when: outputs is defined
87       failed_when: outputs|failed