1 heat_template_version: pike
4 MySQL service deployment with pacemaker bundle
10 DockerMysqlConfigImage:
11 description: The container image to use for the mysql config_volume
15 description: Mapping of service endpoint -> protocol. Typically set
16 via parameter_defaults in the resource registry.
20 description: Dictionary packing service data
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.
37 description: Role name on which the service is applied
41 description: Parameters specific to the role
47 type: ../../containers-common.yaml
50 type: ../../../../puppet/services/pacemaker/database/mysql.yaml
52 EndpointMap: {get_param: EndpointMap}
53 ServiceData: {get_param: ServiceData}
54 ServiceNetMap: {get_param: ServiceNetMap}
55 DefaultPasswords: {get_param: DefaultPasswords}
56 RoleName: {get_param: RoleName}
57 RoleParameters: {get_param: RoleParameters}
61 description: Containerized service MySQL using composable services.
63 service_name: {get_attr: [MysqlPuppetBase, role_data, service_name]}
66 - {get_attr: [MysqlPuppetBase, role_data, config_settings]}
67 - tripleo::profile::pacemaker::database::mysql_bundle::mysql_docker_image: &mysql_image {get_param: DockerMysqlImage}
68 tripleo::profile::pacemaker::database::mysql_bundle::control_port: 3123
69 tripleo.mysql.firewall_rules:
70 '104 mysql galera-bundle':
80 # BEGIN DOCKER SETTINGS #
83 puppet_tags: file # set this even though file is the default
87 - - "['Mysql_datadir', 'Mysql_user', 'Mysql_database', 'Mysql_grant', 'Mysql_plugin'].each |String $val| { noop_resource($val) }"
88 - "exec {'wait-for-settle': command => '/bin/true' }"
89 - "include ::tripleo::profile::pacemaker::database::mysql_bundle"
90 config_image: {get_param: DockerMysqlConfigImage}
92 /var/lib/kolla/config_files/mysql.json:
93 command: /usr/sbin/pacemaker_remoted
95 - dest: /etc/libqb/force-filesystem-sockets
99 - source: "/var/lib/kolla/config_files/src/*"
102 preserve_properties: true
105 mysql_data_ownership:
111 # Kolla does only non-recursive chown
112 command: ['chown', '-R', 'mysql:', '/var/lib/mysql']
114 - /var/lib/mysql:/var/lib/mysql
120 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
121 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
122 volumes: &mysql_volumes
124 - {get_attr: [ContainersCommon, volumes]}
126 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
127 - /var/lib/config-data/puppet-generated/mysql/:/var/lib/kolla/config_files/src:ro
128 - /var/lib/mysql:/var/lib/mysql
130 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
131 - KOLLA_BOOTSTRAP=True
132 # NOTE(mandre) skip wsrep cluster status check
133 - KOLLA_KUBERNETES=True
137 - - 'DB_ROOT_PASSWORD'
140 expression: $.data.passwords.where($ != '').first()
143 - {get_param: MysqlRootPassword}
144 - {get_param: [DefaultPasswords, mysql_root_password]}
158 - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 2}' > /etc/puppet/hieradata/docker.json"
159 - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
161 TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation,galera_ready,mysql_database,mysql_grant,mysql_user'
162 CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::database::mysql_bundle'
165 - /etc/hosts:/etc/hosts:ro
166 - /etc/localtime:/etc/localtime:ro
167 - /etc/puppet:/tmp/puppet-etc:ro
168 - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
169 - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
170 - /dev/shm:/dev/shm:rw
171 - /var/lib/mysql:/var/lib/mysql:rw
173 - name: create /var/lib/mysql
178 - name: get bootstrap nodeid
180 command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
181 register: bootstrap_node
182 - name: set is_bootstrap_node fact
184 set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
185 - name: Disable the galera cluster resource
190 wait_for_resource: true
191 when: is_bootstrap_node
192 - name: Delete the stopped galera cluster resource.
197 wait_for_resource: true
198 when: is_bootstrap_node
199 - name: Disable mysql service
201 service: name=mariadb enabled=no