Merge "Set docker-puppet --health-cmd = /bin/true" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / ovn-dbs.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Ovn DBs service
5
6 parameters:
7   DockerOvnNbDbImage:
8     description: image
9     type: string
10   DockerOvnSbDbImage:
11     description: image
12     type: string
13   DockerOvnNorthdImage:
14     description: image
15     type: string
16   EndpointMap:
17     default: {}
18     description: Mapping of service endpoint -> protocol. Typically set
19                  via parameter_defaults in the resource registry.
20     type: json
21   ServiceData:
22     default: {}
23     description: Dictionary packing service data
24     type: json
25   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.  This
29                  mapping overrides those in ServiceNetMapDefaults.
30     type: json
31   DefaultPasswords:
32     default: {}
33     type: json
34   RoleName:
35     default: ''
36     description: Role name on which the service is applied
37     type: string
38   RoleParameters:
39     default: {}
40     description: Parameters specific to the role
41     type: json
42
43 resources:
44
45   ContainersCommon:
46     type: ./containers-common.yaml
47
48   OVNDbsBase:
49     type: ../../puppet/services/ovn-dbs.yaml
50     properties:
51       EndpointMap: {get_param: EndpointMap}
52       ServiceData: {get_param: ServiceData}
53       ServiceNetMap: {get_param: ServiceNetMap}
54       DefaultPasswords: {get_param: DefaultPasswords}
55       RoleName: {get_param: RoleName}
56       RoleParameters: {get_param: RoleParameters}
57
58 outputs:
59   role_data:
60     description: Role data for the OVN Dbs role.
61     value:
62       service_name: {get_attr: [OVNDbsBase, role_data, service_name]}
63       config_settings:
64         map_merge:
65           - get_attr: [OVNDbsBase, role_data, config_settings]
66       step_config: &step_config
67         get_attr: [OVNDbsBase, role_data, step_config]
68       # BEGIN DOCKER SETTINGS
69       # puppet_config is not required for this service since we configure
70       # the NB and SB DB servers to listen on the proper IP address/port
71       # in the docker_config section.
72       # puppet_config is defined to satisfy the pep8 validations.
73       puppet_config:
74         config_volume: ''
75         config_image: ''
76         step_config: *step_config
77       kolla_config:
78         /var/lib/kolla/config_files/ovn_north_db_server.json:
79           command:
80             list_join:
81             - ' '
82             - - '/usr/sbin/ovsdb-server'
83               - '/var/lib/openvswitch/ovnnb.db'
84               - '--pidfile=/run/openvswitch/ovnnb_db.pid'
85               - '-vconsole:emer -vsyslog:err -vfile:info'
86               - '--remote=punix:/run/openvswitch/ovnnb_db.sock'
87               - '--unixctl=/run/openvswitch/ovnnb_db.ctl'
88               - '--remote=db:OVN_Northbound,NB_Global,connections'
89               - '--private-key=db:OVN_Northbound,SSL,private_key'
90               - '--certificate=db:OVN_Northbound,SSL,certificate'
91               - '--ca-cert=db:OVN_Northbound,SSL,ca_cert'
92               - '--log-file=/var/log/openvswitch/ovsdb-server-nb.log'
93           permissions:
94             - path: /var/log/openvswitch
95               owner: root:root
96               recurse: true
97         /var/lib/kolla/config_files/ovn_south_db_server.json:
98           command:
99             list_join:
100             - ' '
101             - - '/usr/sbin/ovsdb-server'
102               - '/var/lib/openvswitch/ovnsb.db'
103               - '--pidfile=/run/openvswitch/ovnsb_db.pid'
104               - '-vconsole:emer -vsyslog:err -vfile:info'
105               - '--remote=punix:/run/openvswitch/ovnsb_db.sock'
106               - '--unixctl=/run/openvswitch/ovnsb_db.ctl'
107               - '--remote=db:OVN_Southbound,SB_Global,connections'
108               - '--private-key=db:OVN_Southbound,SSL,private_key'
109               - '--certificate=db:OVN_Southbound,SSL,certificate'
110               - '--ca-cert=db:OVN_Southbound,SSL,ca_cert'
111               - '--log-file=/var/log/openvswitch/ovsdb-server-sb.log'
112           permissions:
113             - path: /var/log/openvswitch
114               owner: root:root
115               recurse: true
116         /var/lib/kolla/config_files/ovn_northd.json:
117           command:
118             list_join:
119             - ' '
120             - - '/usr/bin/ovn-northd -vconsole:emer -vsyslog:err -vfile:info'
121               - '--ovnnb-db=unix:/run/openvswitch/ovnnb_db.sock'
122               - '--ovnsb-db=unix:/run/openvswitch/ovnsb_db.sock'
123               - '--log-file=/var/log/openvswitch/ovn-northd.log'
124               - '--pidfile=/run/openvswitch/ovn-northd.pid'
125           permissions:
126             - path: /var/log/openvswitch
127               owner: root:root
128               recurse: true
129       docker_config:
130         step_4:
131           ovn_north_db_server:
132             start_order: 0
133             image: {get_param: DockerOvnNbDbImage}
134             net: host
135             privileged: false
136             restart: always
137             volumes:
138               list_concat:
139                 - {get_attr: [ContainersCommon, volumes]}
140                 -
141                   - /var/lib/kolla/config_files/ovn_north_db_server.json:/var/lib/kolla/config_files/config.json:ro
142                   - /lib/modules:/lib/modules:ro
143                   - /var/lib/openvswitch/ovn:/var/lib/openvswitch
144                   - /var/lib/openvswitch/ovn:/run/openvswitch
145                   - /var/log/containers/openvswitch:/var/log/openvswitch
146             environment:
147               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
148           ovn_south_db_server:
149             start_order: 0
150             image: {get_param: DockerOvnSbDbImage}
151             net: host
152             privileged: false
153             restart: always
154             volumes:
155               list_concat:
156                 - {get_attr: [ContainersCommon, volumes]}
157                 -
158                   - /var/lib/kolla/config_files/ovn_south_db_server.json:/var/lib/kolla/config_files/config.json:ro
159                   - /lib/modules:/lib/modules:ro
160                   - /var/lib/openvswitch/ovn:/var/lib/openvswitch
161                   - /var/lib/openvswitch/ovn:/run/openvswitch
162                   - /var/log/containers/openvswitch:/var/log/openvswitch
163             environment:
164               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
165           configure_ovn_north_db_server:
166             start_order: 1
167             action: exec
168             user: root
169             command: ['ovn_north_db_server', '/bin/bash', '-c', 'DBS_LISTEN_IP=`hiera ovn::northd::dbs_listen_ip -c /etc/puppet/hiera.yaml`; NB_DB_PORT=`hiera ovn::northbound::port -c /etc/puppet/hiera.yaml`; /usr/bin/bootstrap_host_exec ovn_dbs ovn-nbctl set-connection ptcp:$NB_DB_PORT:$DBS_LISTEN_IP']
170           configure_ovn_south_db_server:
171             start_order: 1
172             action: exec
173             user: root
174             command: ['ovn_south_db_server', '/bin/bash', '-c', 'DBS_LISTEN_IP=`hiera ovn::northd::dbs_listen_ip -c /etc/puppet/hiera.yaml`; SB_DB_PORT=`hiera ovn::southbound::port -c /etc/puppet/hiera.yaml`; /usr/bin/bootstrap_host_exec ovn_dbs ovn-sbctl set-connection ptcp:$SB_DB_PORT:$DBS_LISTEN_IP']
175           ovn_northd:
176             start_order: 2
177             image: {get_param: DockerOvnNorthdImage}
178             net: host
179             privileged: false
180             restart: always
181             volumes:
182               list_concat:
183                 - {get_attr: [ContainersCommon, volumes]}
184                 -
185                   - /var/lib/kolla/config_files/ovn_northd.json:/var/lib/kolla/config_files/config.json:ro
186                   - /lib/modules:/lib/modules:ro
187                   - /var/lib/openvswitch/ovn:/run/openvswitch
188                   - /var/log/containers/openvswitch:/var/log/openvswitch
189             environment:
190               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
191       host_prep_tasks:
192         - name: create persistent directories
193           file:
194             path: "{{ item }}"
195             state: directory
196           with_items:
197             - /var/log/containers/openvswitch
198             - /var/lib/openvswitch/ovn
199       upgrade_tasks:
200         - name: Stop and disable ovn-northd service
201           tags: step2
202           service: name=ovn-northd state=stopped enabled=no