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