3cca36d883a58c681996a29e1299134872a8260c
[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: tripleoupstream
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       name: ComputePuppetDeployment
53       servers:  {get_param: servers}
54       config: {get_resource: ComputePuppetConfig}
55       input_values:
56         update_identifier: {get_param: NodeConfigIdentifiers}
57         tripleo::packages::enable_install: True
58
59   CopyEtcConfig:
60     type: OS::Heat::SoftwareConfig
61     properties:
62       group: script
63       outputs:
64       - name: result
65       config: {get_file: ./copy-etc.sh}
66
67   CopyEtcDeployment:
68     type: OS::Heat::SoftwareDeployments
69     depends_on: ComputePuppetDeployment
70     properties:
71       name: CopyEtcDeployment
72       config: {get_resource: CopyEtcConfig}
73       servers:  {get_param: servers}
74
75   CopyJsonConfig:
76     type: OS::Heat::SoftwareConfig
77     properties:
78       group: script
79       outputs:
80       - name: result
81       config: {get_file: ./generate_json_config.sh}
82
83   CopyJsonDeployment:
84     type: OS::Heat::SoftwareDeployments
85     depends_on: CopyEtcDeployment
86     properties:
87       name: CopyJsonDeployment
88       config: {get_resource: CopyJsonConfig}
89       servers:  {get_param: servers}
90
91   NovaComputeContainersDeploymentOVS:
92     type: OS::Heat::StructuredDeployments
93     depends_on: CopyJsonDeployment
94     properties:
95       name: NovaComputeContainersDeploymentOVS
96       config: {get_resource: NovaComputeContainersConfigOVS}
97       servers: {get_param: servers}
98
99   NovaComputeContainersConfigOVS:
100     type: OS::Heat::StructuredConfig
101     properties:
102       group: docker-compose
103       config:
104         ovsvswitchd:
105           image:
106             list_join:
107             - '/'
108             - [ {get_param: DockerNamespace}, {get_param: DockerOvsVswitchdImage} ]
109           container_name: ovs-vswitchd
110           net: host
111           privileged: true
112           restart: always
113           volumes:
114            - /run:/run
115            - /lib/modules:/lib/modules:ro
116            - /var/lib/etc-data/json-config/ovs-vswitchd.json:/var/lib/kolla/config_files/config.json
117           environment:
118            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
119
120         openvswitchdb:
121           image:
122             list_join:
123             - '/'
124             - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchDBImage} ]
125           container_name: ovs-db-server
126           net: host
127           restart: always
128           volumes:
129            - /run:/run
130            - /var/lib/etc-data/json-config/ovs-dbserver.json:/var/lib/kolla/config_files/config.json
131           environment:
132            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
133
134   NovaComputeContainersDeploymentNetconfig:
135     type: OS::Heat::SoftwareDeployments
136     depends_on: NovaComputeContainersDeploymentOVS
137     properties:
138       name: NovaComputeContainersDeploymentNetconfig
139       config: {get_resource: NovaComputeContainersConfigNetconfig}
140       servers: {get_param: servers}
141
142   # We run os-net-config here because we depend on the ovs containers to be up
143   # and running before we configure the network.  This allows explicit timing
144   # of the network configuration.
145   NovaComputeContainersConfigNetconfig:
146     type: OS::Heat::SoftwareConfig
147     properties:
148       group: script
149       outputs:
150       - name: result
151       config: |
152         #!/bin/bash
153         /usr/local/bin/run-os-net-config
154
155   LibvirtContainersDeployment:
156     type: OS::Heat::StructuredDeployments
157     depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
158     properties:
159       name: LibvirtContainersDeployment
160       config: {get_resource: LibvirtContainersConfig}
161       servers: {get_param: servers}
162
163   LibvirtContainersConfig:
164     type: OS::Heat::StructuredConfig
165     properties:
166       group: docker-compose
167       config:
168         computedata:
169           image:
170             list_join:
171             - '/'
172             - [ {get_param: DockerNamespace}, {get_param: DockerComputeDataImage} ]
173           container_name: computedata
174           volumes:
175            - /var/lib/nova/instances
176            - /var/lib/libvirt
177
178         libvirt:
179           image:
180             list_join:
181             - '/'
182             - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
183           container_name: libvirt
184           net: host
185           pid: host
186           privileged: true
187           restart: always
188           volumes:
189            - /run:/run
190            - /lib/modules:/lib/modules:ro
191            - /sys/fs/cgroup:/sys/fs/cgroup
192            - /var/lib/etc-data/json-config/nova-libvirt.json:/var/lib/kolla/config_files/config.json
193            - /var/lib/etc-data/libvirt/libvirtd.conf:/var/lib/kolla/config_files/libvirtd.conf
194           environment:
195            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
196           volumes_from:
197            - computedata
198
199   NovaComputeContainersDeployment:
200     type: OS::Heat::StructuredDeployments
201     depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
202     properties:
203       name: NovaComputeContainersDeployment
204       config: {get_resource: NovaComputeContainersConfig}
205       servers: {get_param: servers}
206
207   NovaComputeContainersConfig:
208     type: OS::Heat::StructuredConfig
209     properties:
210       group: docker-compose
211       config:
212         openvswitch:
213           image:
214             list_join:
215             - '/'
216             - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchImage} ]
217           container_name: openvswitch
218           net: host
219           privileged: true
220           restart: always
221           volumes:
222            - /run:/run
223            - /lib/modules:/lib/modules:ro
224            - /var/lib/etc-data/json-config/neutron-openvswitch-agent.json:/var/lib/kolla/config_files/config.json
225            - /var/lib/etc-data/neutron/neutron.conf:/etc/kolla/neutron-openvswitch-agent/:ro
226            - /var/lib/etc-data/neutron/plugins/ml2/ml2_conf.ini:/var/lib/kolla/config_files/ml2_conf.ini:ro
227            - /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro
228           environment:
229            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
230           volumes_from:
231            - computedata
232
233         neutronagent:
234           image:
235             list_join:
236             - '/'
237             - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchImage} ]
238           container_name: neutronagent
239           net: host
240           pid: host
241           privileged: true
242           restart: always
243           volumes:
244            - /run:/run
245            - /lib/modules:/lib/modules:ro
246            - /var/lib/etc-data/json-config/neutron-agent.json:/var/lib/kolla/config_files/config.json
247            - /var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/ovs_neutron_plugin.ini:ro
248            - /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro
249           environment:
250            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
251           volumes_from:
252            - computedata
253
254         novacompute:
255           image:
256             list_join:
257             - '/'
258             - [ {get_param: DockerNamespace}, {get_param: DockerComputeImage} ]
259           container_name: novacompute
260           net: host
261           privileged: true
262           restart: always
263           volumes:
264            - /run:/run
265            - /lib/modules:/lib/modules:ro
266            - /var/lib/etc-data/json-config/nova-compute.json:/var/lib/kolla/config_files/config.json
267            - /var/lib/etc-data/nova/nova.conf:/var/lib/kolla/config_files/nova.conf:ro
268           environment:
269            - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
270           volumes_from:
271            - computedata
272
273   ExtraConfig:
274     depends_on: NovaComputeContainersDeployment
275     type: OS::TripleO::NodeExtraConfigPost
276     properties:
277         servers: {get_param: servers}