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