aboutsummaryrefslogtreecommitdiffstats
path: root/docker/post.j2.yaml
blob: 6cb92c83e416205c9c387e3bd12739a82235a65d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
heat_template_version: 2016-10-14

description: >
  Post-deploy configuration steps via puppet for all roles,
  as defined in ../roles_data.yaml

parameters:
  servers:
    type: json
    description: Mapping of Role name e.g Controller to a list of servers

  role_data:
    type: json
    description: Mapping of Role name e.g Controller to the per-role data

  DeployIdentifier:
    default: ''
    type: string
    description: >
      Setting this to a unique value will re-run any deployment tasks which
      perform configuration on a Heat stack-update.

  DockerNamespace:
    description: namespace
    default: 'tripleoupstream'
    type: string

  DockerOpenvswitchDBImage:
    description: image
    default: 'centos-binary-openvswitch-db-server'
    type: string

  DockerOvsVswitchdImage:
    description: image
    default: 'centos-binary-openvswitch-vswitchd'
    type: string

  LibvirtConfig:
    type: string
    default: "/etc/libvirt/libvirtd.conf"

  NovaConfig:
    type: string
    default: "/etc/nova/nova.conf,/etc/nova/rootwrap.conf"

  NeutronOpenvswitchAgentConfig:
    type: string
    default: "/etc/neutron/neutron.conf,/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"

resources:

{% for role in roles %}
  # Post deployment steps for all roles
  # A single config is re-applied with an incrementing step number
  # {{role.name}} Role steps
  {{role.name}}ArtifactsConfig:
    type: ../puppet/deploy-artifacts.yaml

  {{role.name}}ArtifactsDeploy:
    type: OS::Heat::StructuredDeploymentGroup
    properties:
      servers:  {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}ArtifactsConfig}

  {{role.name}}PreConfig:
    type: OS::TripleO::Tasks::{{role.name}}PreConfig
    properties:
      servers: {get_param: [servers, {{role.name}}]}
      input_values:
        update_identifier: {get_param: DeployIdentifier}

  {{role.name}}Config:
    type: OS::TripleO::{{role.name}}Config
    properties:
      StepConfig: {get_param: [role_data, {{role.name}}, step_config]}
  {% if role.name.lower() == 'compute' %}
      PuppetTags: {get_param: [role_data, {{role.name}}, puppet_tags]}
  {% endif %}

  # Step through a series of configuration steps
  {{role.name}}Deployment_Step1:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on: [{{role.name}}PreConfig, {{role.name}}ArtifactsDeploy]
    properties:
      name: {{role.name}}Deployment_Step1
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}Config}
      input_values:
        step: 1
        update_identifier: {get_param: DeployIdentifier}

  {{role.name}}Deployment_Step2:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on:
  {% for dep in roles %}
      - {{dep.name}}Deployment_Step1
  {% endfor %}
    properties:
      name: {{role.name}}Deployment_Step2
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}Config}
      input_values:
        step: 2
        update_identifier: {get_param: DeployIdentifier}

  {{role.name}}Deployment_Step3:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on:
  {% for dep in roles %}
      - {{dep.name}}Deployment_Step2
  {% endfor %}
    properties:
      name: {{role.name}}Deployment_Step3
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}Config}
      input_values:
        step: 3
        update_identifier: {get_param: DeployIdentifier}

  {{role.name}}Deployment_Step4:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on:
  {% for dep in roles %}
      - {{dep.name}}Deployment_Step3
  {% endfor %}
    properties:
      name: {{role.name}}Deployment_Step4
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}Config}
      input_values:
        step: 4
        update_identifier: {get_param: DeployIdentifier}

  {{role.name}}Deployment_Step5:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on:
  {% for dep in roles %}
      - {{dep.name}}Deployment_Step4
  {% endfor %}
    properties:
      name: {{role.name}}Deployment_Step5
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}Config}
      input_values:
        step: 5
        update_identifier: {get_param: DeployIdentifier}

  {{role.name}}PostConfig:
    type: OS::TripleO::Tasks::{{role.name}}PostConfig
    depends_on:
  {% for dep in roles %}
      - {{dep.name}}Deployment_Step5
  {% endfor %}
    properties:
      servers:  {get_param: servers}
      input_values:
        update_identifier: {get_param: DeployIdentifier}

  # Note, this should come last, so use depends_on to ensure
  # this is created after any other resources.
  {{role.name}}ExtraConfigPost:
    depends_on:
  {% for dep in roles %}
      - {{dep.name}}PostConfig
  {% endfor %}
    type: OS::TripleO::NodeExtraConfigPost
    properties:
        servers: {get_param: [servers, {{role.name}}]}

  {% if role.name.lower() == 'compute' %}
  CopyEtcConfig:
    type: OS::Heat::SoftwareConfig
    depends_on: {{role.name}}PostConfig
    properties:
      group: script
      outputs:
        - name: result
      config: {get_file: ../docker/copy-etc.sh}

  CopyEtcDeployment:
    type: OS::Heat::SoftwareDeploymentGroup
    properties:
      name: CopyEtcDeployment
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: CopyEtcConfig}

  CopyJsonConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      inputs:
      - name: libvirt_config
      - name: nova_config
      - name: neutron_openvswitch_agent_config
      config: {get_file: ../docker/copy-json.py}

  CopyJsonDeployment:
    type: OS::Heat::SoftwareDeploymentGroup
    depends_on: CopyEtcDeployment
    properties:
      name: CopyJsonDeployment
      config: {get_resource: CopyJsonConfig}
      servers: {get_param: [servers, {{role.name}}]}
      input_values:
        libvirt_config: {get_param: LibvirtConfig}
        nova_config: {get_param: NovaConfig}
        neutron_openvswitch_agent_config: {get_param: NeutronOpenvswitchAgentConfig}

  NovaComputeContainersDeploymentOVS:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on: CopyJsonDeployment
    properties:
      name: NovaComputeContainersDeploymentOVS
      config: {get_resource: NovaComputeContainersConfigOVS}
      servers: {get_param: [servers, {{role.name}}]}

  NovaComputeContainersConfigOVS:
    type: OS::Heat::StructuredConfig
    properties:
      group: docker-cmd
      config:
        openvswitchdb:
          image:
            list_join:
              - '/'
              - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchDBImage} ]
          net: host
          restart: always
          volumes:
            - /var/lib/etc-data/json-config/ovsdb-server.json:/var/lib/kolla/config_files/config.json
            - /etc/localtime:/etc/localtime:ro
            - /run:/run
            - logs:/var/log/kolla/
            - openvswitch_db:/var/lib/openvswitch/
          environment:
            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS

        ovsvswitchd:
          image:
            list_join:
              - '/'
              - [ {get_param: DockerNamespace}, {get_param: DockerOvsVswitchdImage} ]
          net: host
          privileged: true
          restart: always
          volumes:
            - /var/lib/etc-data/json-config/ovs-vswitchd.json:/var/lib/kolla/config_files/config.json
            - /etc/localtime:/etc/localtime:ro
            - /lib/modules:/lib/modules:ro
            - /run:/run
            - logs:/var/log/kolla/
          environment:
            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS

  {{role.name}}ContainersConfig_Step1:
    type: OS::Heat::StructuredConfig
    depends_on: CopyJsonDeployment
    properties:
      group: docker-cmd
      config:
        {get_param: [role_data, {{role.name}}, docker_config, step_1]}

  {{role.name}}ContainersConfig_Step2:
    type: OS::Heat::StructuredConfig
    depends_on: CopyJsonDeployment
    properties:
      group: docker-cmd
      config:
        {get_param: [role_data, {{role.name}}, docker_config, step_2]}

  {{role.name}}ContainersDeployment_Step1:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on: [{{role.name}}PreConfig, {{role.name}}ArtifactsDeploy]
    properties:
      name: {{role.name}}ContainersDeployment_Step1
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}ContainersConfig_Step1}

  {{role.name}}ContainersDeployment_Step2:
    type: OS::Heat::StructuredDeploymentGroup
    depends_on: {{role.name}}ContainersDeployment_Step1
    properties:
      name: {{role.name}}ContainersDeployment_Step2
      servers: {get_param: [servers, {{role.name}}]}
      config: {get_resource: {{role.name}}ContainersConfig_Step2}
  {% endif %}
{% endfor %}