Merge "Adds post_upgrade_tasks for any service post-upgrade ansible tasks" into stabl...
[apex-tripleo-heat-templates.git] / docker / services / pacemaker / ovn-dbs.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized OVN DBs service managed by pacemaker
5
6 parameters:
7   DockerOvnDbsImage:
8     description: image
9     type: string
10   DockerOvnDbsConfigImage:
11     description: image
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39   OVNNorthboundServerPort:
40     description: Port of the OVN Northbound DB server
41     type: number
42     default: 6641
43   OVNSouthboundServerPort:
44     description: Port of the OVN Southbound DB server
45     type: number
46     default: 6642
47
48 resources:
49
50   ContainersCommon:
51     type: ./../containers-common.yaml
52
53   OVNDbsBase:
54     type: ../../../puppet/services/pacemaker/ovn-dbs.yaml
55     properties:
56       EndpointMap: {get_param: EndpointMap}
57       ServiceData: {get_param: ServiceData}
58       ServiceNetMap: {get_param: ServiceNetMap}
59       DefaultPasswords: {get_param: DefaultPasswords}
60       RoleName: {get_param: RoleName}
61       RoleParameters: {get_param: RoleParameters}
62       OVNNorthboundServerPort: {get_param: OVNNorthboundServerPort}
63       OVNSouthboundServerPort: {get_param: OVNSouthboundServerPort}
64
65 outputs:
66   role_data:
67     description: Role data for the OVN Dbs HA role.
68     value:
69       service_name: {get_attr: [OVNDbsBase, role_data, service_name]}
70       config_settings:
71         map_merge:
72           - get_attr: [OVNDbsBase, role_data, config_settings]
73           - tripleo::profile::pacemaker::ovn_dbs_bundle::ovn_dbs_docker_image: {get_param: DockerOvnDbsImage}
74           - tripleo::profile::pacemaker::ovn_dbs_bundle::nb_db_port: {get_param: OVNNorthboundServerPort}
75           - tripleo::profile::pacemaker::ovn_dbs_bundle::sb_db_port: {get_param: OVNSouthboundServerPort}
76       step_config: ''
77       service_config_settings: {get_attr: [OVNDbsBase, role_data, service_config_settings]}
78       # BEGIN DOCKER SETTINGS
79       puppet_config:
80         config_volume: 'ovn_dbs'
81         puppet_tags: 'exec'
82         step_config: ''
83         config_image: &ovn_dbs_config_image {get_param: DockerOvnDbsConfigImage}
84       kolla_config:
85         /var/lib/kolla/config_files/ovn_dbs.json:
86           command: /usr/sbin/pacemaker_remoted
87           config_files:
88             - dest: /etc/libqb/force-filesystem-sockets
89               source: /dev/null
90               owner: root
91               perm: '0644'
92             - source: "/var/lib/kolla/config_files/src/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96               optional: true
97       docker_config:
98         step_3:
99           ovn_dbs_init_bundle:
100             start_order: 1
101             detach: false
102             net: host
103             user: root
104             config_volume: 'ovn_dbs_init_bundle'
105             command:
106               - '/bin/bash'
107               - '-c'
108               - str_replace:
109                   template:
110                     list_join:
111                       - '; '
112                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 3}' > /etc/puppet/hieradata/docker.json"
113                         - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
114                   params:
115                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ip,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
116                     CONFIG:
117                       list_join:
118                         - ';'
119                         - - 'include ::tripleo::profile::base::pacemaker'
120                           - 'include ::tripleo::profile::pacemaker::ovn_dbs_bundle'
121             image: *ovn_dbs_config_image
122             volumes:
123               - /etc/hosts:/etc/hosts:ro
124               - /etc/localtime:/etc/localtime:ro
125               - /etc/puppet:/tmp/puppet-etc:ro
126               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
127               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
128               - /dev/shm:/dev/shm:rw
129       host_prep_tasks:
130         - name: create persistent directories
131           file:
132             path: "{{ item }}"
133             state: directory
134           with_items:
135             - /var/log/containers/openvswitch
136             - /var/lib/openvswitch/ovn
137       upgrade_tasks:
138         - name: Stop and disable ovn-northd service
139           tags: step2
140           service: name=ovn-northd state=stopped enabled=no