5dd887262e51485edecf06de6e3ff5cfbca38964
[apex-tripleo-heat-templates.git] / docker / compute-post.yaml
1 heat_template_version: 2015-04-30
2
3 description: >
4   OpenStack compute node post deployment for Docker.
5
6 parameters:
7   servers:
8     type: json
9   NodeConfigIdentifiers:
10      type: json
11      description: Value which changes if the node configuration may need to be re-applied
12   DockerNamespace:
13     type: string
14     default: kollaglue
15   DockerComputeImage:
16     type: string
17   DockerComputeDataImage:
18     type: string
19   DockerLibvirtImage:
20     type: string
21   DockerNeutronAgentImage:
22     type: string
23   DockerOpenvswitchImage:
24     type: string
25   DockerOvsVswitchdImage:
26     type: string
27   DockerOpenvswitchDBImage:
28     type: string
29
30 resources:
31
32   ComputePuppetConfig:
33     type: OS::Heat::SoftwareConfig
34     properties:
35       group: puppet
36       options:
37         enable_hiera: True
38         enable_facter: False
39         tags: package,file,concat,file_line,nova_config,neutron_config,neutron_agent_ovs,neutron_plugin_ml2
40       inputs:
41       - name: tripleo::packages::enable_install
42         type: Boolean
43         default: True
44       outputs:
45       - name: result
46       config:
47         get_file: ../puppet/manifests/overcloud_compute.pp
48
49   ComputePuppetDeployment:
50     type: OS::Heat::SoftwareDeployments
51     properties:
52       servers:  {get_param: servers}
53       config: {get_resource: ComputePuppetConfig}
54       input_values:
55         update_identifier: {get_param: NodeConfigIdentifiers}
56         tripleo::packages::enable_install: True
57
58   CopyEtcConfig:
59     type: OS::Heat::SoftwareConfig
60     properties:
61       group: script
62       outputs:
63       - name: result
64       config: {get_file: ./copy-etc.sh}
65
66   CopyEtcDeployment:
67     type: OS::Heat::SoftwareDeployments
68     depends_on: ComputePuppetDeployment
69     properties:
70       config: {get_resource: CopyEtcConfig}
71       servers:  {get_param: servers}
72
73   CopyJsonConfig:
74     type: OS::Heat::SoftwareConfig
75     properties:
76       group: script
77       outputs:
78       - name: result
79       config: {get_file: ./generate_json_config.sh}
80
81   CopyJsonDeployment:
82     type: OS::Heat::SoftwareDeployments
83     depends_on: CopyEtcDeployment
84     properties:
85       config: {get_resource: CopyJsonConfig}
86       servers:  {get_param: servers}
87
88   NovaComputeContainersDeploymentOVS:
89     type: OS::Heat::StructuredDeployments
90     depends_on: CopyJsonDeployment
91     properties:
92       config: {get_resource: NovaComputeContainersConfigOVS}
93       servers: {get_param: servers}
94
95   NovaComputeContainersConfigOVS:
96     type: OS::Heat::StructuredConfig
97     properties:
98       group: docker-compose
99       config:
100         ovsvswitchd:
101           image:
102             list_join:
103             - '/'
104             - [ {get_param: DockerNamespace}, {get_param: DockerOvsVswitchdImage} ]
105           container_name: ovs-vswitchd
106           net: host
107           privileged: true
108           restart: always
109           volumes:
110            - /run:/run
111            - /lib/modules:/lib/modules:ro
112            - /var/lib/etc-data/json-config/ovs-vswitchd.json:/var/lib/kolla/config_files/config.json
113           environment:
114            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
115
116         openvswitchdb:
117           image:
118             list_join:
119             - '/'
120             - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchDBImage} ]
121           container_name: ovs-db-server
122           net: host
123           restart: always
124           volumes:
125            - /run:/run
126            - /var/lib/etc-data/json-config/ovs-dbserver.json:/var/lib/kolla/config_files/config.json
127           environment:
128            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
129
130   NovaComputeContainersDeploymentNetconfig:
131     type: OS::Heat::SoftwareDeployments
132     depends_on: NovaComputeContainersDeploymentOVS
133     properties:
134       config: {get_resource: NovaComputeContainersConfigNetconfig}
135       servers: {get_param: servers}
136
137   # We run os-net-config here because we depend on the ovs containers to be up
138   # and running before we configure the network.  This allows explicit timing
139   # of the network configuration.
140   NovaComputeContainersConfigNetconfig:
141     type: OS::Heat::SoftwareConfig
142     properties:
143       group: script
144       outputs:
145       - name: result
146       config: |
147         #!/bin/bash
148         /usr/local/bin/run-os-net-config
149
150   LibvirtContainersDeployment:
151     type: OS::Heat::StructuredDeployments
152     depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
153     properties:
154       config: {get_resource: LibvirtContainersConfig}
155       servers: {get_param: servers}
156
157   LibvirtContainersConfig:
158     type: OS::Heat::StructuredConfig
159     properties:
160       group: docker-compose
161       config:
162         computedata:
163           image:
164             list_join:
165             - '/'
166             - [ {get_param: DockerNamespace}, {get_param: DockerComputeDataImage} ]
167           container_name: computedata
168           volumes:
169            - /var/lib/nova/instances
170            - /var/lib/libvirt
171
172         libvirt:
173           image:
174             list_join:
175             - '/'
176             - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
177           container_name: libvirt
178           net: host
179           pid: host
180           privileged: true
181           restart: always
182           volumes:
183            - /run:/run
184            - /lib/modules:/lib/modules:ro
185            - /var/lib/etc-data/json-config/nova-libvirt.json:/var/lib/kolla/config_files/config.json
186            - /var/lib/etc-data/libvirt/libvirtd.conf:/var/lib/kolla/config_files/libvirtd.conf
187           environment:
188            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
189           volumes_from:
190            - computedata
191
192   NovaComputeContainersDeployment:
193     type: OS::Heat::StructuredDeployments
194     depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
195     properties:
196       config: {get_resource: NovaComputeContainersConfig}
197       servers: {get_param: servers}
198
199   NovaComputeContainersConfig:
200     type: OS::Heat::StructuredConfig
201     properties:
202       group: docker-compose
203       config:
204         openvswitch:
205           image:
206             list_join:
207             - '/'
208             - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchImage} ]
209           container_name: openvswitch
210           net: host
211           privileged: true
212           restart: always
213           volumes:
214            - /run:/run
215            - /lib/modules:/lib/modules:ro
216            - /var/lib/etc-data/json-config/neutron-openvswitch-agent.json:/var/lib/kolla/config_files/config.json
217            - /var/lib/etc-data/neutron/neutron.conf:/etc/kolla/neutron-openvswitch-agent/:ro
218            - /var/lib/etc-data/neutron/plugins/ml2/ml2_conf.ini:/var/lib/kolla/config_files/ml2_conf.ini:ro
219            - /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro
220           environment:
221            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
222           volumes_from:
223            - computedata
224
225         neutronagent:
226           image:
227             list_join:
228             - '/'
229             - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchImage} ]
230           container_name: neutronagent
231           net: host
232           pid: host
233           privileged: true
234           restart: always
235           volumes:
236            - /run:/run
237            - /lib/modules:/lib/modules:ro
238            - /var/lib/etc-data/json-config/neutron-agent.json:/var/lib/kolla/config_files/config.json
239            - /var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/ovs_neutron_plugin.ini:ro
240            - /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro
241           environment:
242            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
243           volumes_from:
244            - computedata
245
246         novacompute:
247           image:
248             list_join:
249             - '/'
250             - [ {get_param: DockerNamespace}, {get_param: DockerComputeImage} ]
251           container_name: novacompute
252           net: host
253           privileged: true
254           restart: always
255           volumes:
256            - /run:/run
257            - /sys/fs/cgroup:/sys/fs/cgroup
258            - /lib/modules:/lib/modules:ro
259            - /var/lib/etc-data/json-config/nova-compute.json:/var/lib/kolla/config_files/config.json
260            - /var/lib/etc-data/nova/nova.conf:/var/lib/kolla/config_files/nova.conf:ro
261           environment:
262            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
263           volumes_from:
264            - computedata
265
266   ExtraConfig:
267     depends_on: NovaComputeContainersDeployment
268     type: OS::TripleO::NodeExtraConfigPost
269     properties:
270         servers: {get_param: servers}