1 # Note the indentation here is required as it's joined
2 # to create a playbook in deploy-steps.j2
4 #####################################################
5 # Per step puppet configuration of the baremetal host
6 #####################################################
7 - name: Set host puppet debugging fact string
9 host_puppet_config_debug: "--debug --verbose"
10 when: enable_debug|default(false)
11 - name: Write the config_step hieradata
12 copy: content="{{dict(step=step|int)|to_json}}" dest=/etc/puppet/hieradata/config_step.json force=true mode=0600
13 - name: Run puppet host configuration for step {{step}}
15 puppet apply {{ host_puppet_config_debug|default('') }}
16 --modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
18 --logdest syslog --logdest console --color=false
19 /var/lib/tripleo-config/puppet_step_config.pp
20 changed_when: outputs.rc == 2
25 - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
26 when: outputs is defined
27 failed_when: outputs.rc not in [0, 2]
28 ######################################
29 # Generate config via docker-puppet.py
30 ######################################
31 - name: Run docker-puppet tasks (generate config)
32 shell: python /var/lib/docker-puppet/docker-puppet.py
35 DEBUG: '{{docker_puppet_debug|default(false)}}'
36 PROCESS_COUNT: '{{docker_puppet_process_count|default(3)}}'
43 - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
44 when: outputs is defined
45 failed_when: outputs|failed
46 ##################################################
47 # Per step starting of the containers using paunch
48 ##################################################
49 - name: Check if /var/lib/hashed-tripleo-config/docker-container-startup-config-step_{{step}}.json exists
51 path: /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
52 register: docker_config_json
53 # Note docker-puppet.py generates the hashed-*.json file, which is a copy of
54 # the *step_n.json with a hash of the generated external config added
55 # This acts as a salt to enable restarting the container if config changes
56 - name: Start containers for step {{step}}
59 --file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
60 --config-id tripleo_step{{step}} --managed-by tripleo-{{role_name}}
61 when: docker_config_json.stat.exists
67 - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
68 when: outputs is defined
69 failed_when: outputs|failed
70 ########################################################
71 # Bootstrap tasks, only performed on bootstrap_server_id
72 ########################################################
73 - name: Check if /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json exists
75 path: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
76 register: docker_puppet_tasks_json
77 - name: Run docker-puppet tasks (bootstrap tasks)
78 shell: python /var/lib/docker-puppet/docker-puppet.py
80 CONFIG: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
84 when: deploy_server_id == bootstrap_server_id and docker_puppet_tasks_json.stat.exists
90 - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
91 when: outputs is defined
92 failed_when: outputs|failed