Change flat network name for nosdn fdio scenario
[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: Set host puppet debugging fact string
8       set_fact:
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}}
14       command: >-
15         puppet apply {{ host_puppet_config_debug|default('') }}
16         --modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
17         --detailed-exitcodes
18         --logdest syslog --logdest console --color=false
19         /var/lib/tripleo-config/puppet_step_config.pp
20       changed_when: outputs.rc == 2
21       check_mode: no
22       register: outputs
23       failed_when: false
24       no_log: true
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
33       environment:
34         NET_HOST: 'true'
35         DEBUG: '{{docker_puppet_debug|default(false)}}'
36         PROCESS_COUNT: '{{docker_puppet_process_count|default(3)}}'
37       when: step == "1"
38       changed_when: false
39       check_mode: no
40       register: outputs
41       failed_when: false
42       no_log: true
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
50       stat:
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}}
57       command: >-
58         paunch --debug apply
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
62       changed_when: false
63       check_mode: no
64       register: outputs
65       failed_when: false
66       no_log: true
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
74       stat:
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
79       environment:
80         CONFIG: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
81         NET_HOST: "true"
82         NO_ARCHIVE: "true"
83         STEP: "{{step}}"
84       when: deploy_server_id == bootstrap_server_id and docker_puppet_tasks_json.stat.exists
85       changed_when: false
86       check_mode: no
87       register: outputs
88       failed_when: false
89       no_log: true
90     - debug: var=(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))
91       when: outputs is defined
92       failed_when: outputs|failed