docker: add logging(source & groups)
[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       logging_source: {get_attr: [OVNDbsBase, role_data, logging_source]}
67       logging_groups: {get_attr: [OVNDbsBase, role_data, logging_groups]}
68       step_config: &step_config
69         get_attr: [OVNDbsBase, role_data, step_config]
70       # BEGIN DOCKER SETTINGS
71       # puppet_config is not required for this service since we configure
72       # the NB and SB DB servers to listen on the proper IP address/port
73       # in the docker_config section.
74       # puppet_config is defined to satisfy the pep8 validations.
75       puppet_config:
76         config_volume: ''
77         config_image: ''
78         step_config: *step_config
79       kolla_config:
80         /var/lib/kolla/config_files/ovn_north_db_server.json:
81           command:
82             list_join:
83             - ' '
84             - - '/usr/sbin/ovsdb-server'
85               - '/var/lib/openvswitch/ovnnb.db'
86               - '--pidfile=/run/openvswitch/ovnnb_db.pid'
87               - '-vconsole:emer -vsyslog:err -vfile:info'
88               - '--remote=punix:/run/openvswitch/ovnnb_db.sock'
89               - '--unixctl=/run/openvswitch/ovnnb_db.ctl'
90               - '--remote=db:OVN_Northbound,NB_Global,connections'
91               - '--private-key=db:OVN_Northbound,SSL,private_key'
92               - '--certificate=db:OVN_Northbound,SSL,certificate'
93               - '--ca-cert=db:OVN_Northbound,SSL,ca_cert'
94               - '--log-file=/var/log/openvswitch/ovsdb-server-nb.log'
95           permissions:
96             - path: /var/log/openvswitch
97               owner: root:root
98               recurse: true
99         /var/lib/kolla/config_files/ovn_south_db_server.json:
100           command:
101             list_join:
102             - ' '
103             - - '/usr/sbin/ovsdb-server'
104               - '/var/lib/openvswitch/ovnsb.db'
105               - '--pidfile=/run/openvswitch/ovnsb_db.pid'
106               - '-vconsole:emer -vsyslog:err -vfile:info'
107               - '--remote=punix:/run/openvswitch/ovnsb_db.sock'
108               - '--unixctl=/run/openvswitch/ovnsb_db.ctl'
109               - '--remote=db:OVN_Southbound,SB_Global,connections'
110               - '--private-key=db:OVN_Southbound,SSL,private_key'
111               - '--certificate=db:OVN_Southbound,SSL,certificate'
112               - '--ca-cert=db:OVN_Southbound,SSL,ca_cert'
113               - '--log-file=/var/log/openvswitch/ovsdb-server-sb.log'
114           permissions:
115             - path: /var/log/openvswitch
116               owner: root:root
117               recurse: true
118         /var/lib/kolla/config_files/ovn_northd.json:
119           command:
120             list_join:
121             - ' '
122             - - '/usr/bin/ovn-northd -vconsole:emer -vsyslog:err -vfile:info'
123               - '--ovnnb-db=unix:/run/openvswitch/ovnnb_db.sock'
124               - '--ovnsb-db=unix:/run/openvswitch/ovnsb_db.sock'
125               - '--log-file=/var/log/openvswitch/ovn-northd.log'
126               - '--pidfile=/run/openvswitch/ovn-northd.pid'
127           permissions:
128             - path: /var/log/openvswitch
129               owner: root:root
130               recurse: true
131       docker_config:
132         step_4:
133           ovn_north_db_server:
134             start_order: 0
135             image: {get_param: DockerOvnNbDbImage}
136             net: host
137             privileged: false
138             restart: always
139             volumes:
140               list_concat:
141                 - {get_attr: [ContainersCommon, volumes]}
142                 -
143                   - /var/lib/kolla/config_files/ovn_north_db_server.json:/var/lib/kolla/config_files/config.json:ro
144                   - /lib/modules:/lib/modules:ro
145                   - /var/lib/openvswitch/ovn:/var/lib/openvswitch
146                   - /var/lib/openvswitch/ovn:/run/openvswitch
147                   - /var/log/containers/openvswitch:/var/log/openvswitch
148             environment:
149               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
150           ovn_south_db_server:
151             start_order: 0
152             image: {get_param: DockerOvnSbDbImage}
153             net: host
154             privileged: false
155             restart: always
156             volumes:
157               list_concat:
158                 - {get_attr: [ContainersCommon, volumes]}
159                 -
160                   - /var/lib/kolla/config_files/ovn_south_db_server.json:/var/lib/kolla/config_files/config.json:ro
161                   - /lib/modules:/lib/modules:ro
162                   - /var/lib/openvswitch/ovn:/var/lib/openvswitch
163                   - /var/lib/openvswitch/ovn:/run/openvswitch
164                   - /var/log/containers/openvswitch:/var/log/openvswitch
165             environment:
166               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
167           configure_ovn_north_db_server:
168             start_order: 1
169             action: exec
170             user: root
171             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']
172           configure_ovn_south_db_server:
173             start_order: 1
174             action: exec
175             user: root
176             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']
177           ovn_northd:
178             start_order: 2
179             image: {get_param: DockerOvnNorthdImage}
180             net: host
181             privileged: false
182             restart: always
183             volumes:
184               list_concat:
185                 - {get_attr: [ContainersCommon, volumes]}
186                 -
187                   - /var/lib/kolla/config_files/ovn_northd.json:/var/lib/kolla/config_files/config.json:ro
188                   - /lib/modules:/lib/modules:ro
189                   - /var/lib/openvswitch/ovn:/run/openvswitch
190                   - /var/log/containers/openvswitch:/var/log/openvswitch
191             environment:
192               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
193       host_prep_tasks:
194         - name: create persistent directories
195           file:
196             path: "{{ item }}"
197             state: directory
198           with_items:
199             - /var/log/containers/openvswitch
200             - /var/lib/openvswitch/ovn
201       upgrade_tasks:
202         - name: Stop and disable ovn-northd service
203           tags: step2
204           service: name=ovn-northd state=stopped enabled=no