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}
69 # BEGIN DOCKER SETTINGS #
72 puppet_tags: file # set this even though file is the default
76 - - "['Mysql_datadir', 'Mysql_user', 'Mysql_database', 'Mysql_grant', 'Mysql_plugin'].each |String $val| { noop_resource($val) }"
77 - "exec {'wait-for-settle': command => '/bin/true' }"
78 - "include ::tripleo::profile::pacemaker::database::mysql_bundle"
79 config_image: {get_param: DockerMysqlConfigImage}
81 /var/lib/kolla/config_files/mysql.json:
82 command: /usr/sbin/pacemaker_remoted
84 - dest: /etc/libqb/force-filesystem-sockets
88 - source: "/var/lib/kolla/config_files/src/*"
91 preserve_properties: true
100 # Kolla does only non-recursive chown
101 command: ['chown', '-R', 'mysql:', '/var/lib/mysql']
103 - /var/lib/mysql:/var/lib/mysql
109 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
110 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
111 volumes: &mysql_volumes
113 - {get_attr: [ContainersCommon, volumes]}
115 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
116 - /var/lib/config-data/puppet-generated/mysql/:/var/lib/kolla/config_files/src:ro
117 - /var/lib/mysql:/var/lib/mysql
119 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
120 - KOLLA_BOOTSTRAP=True
121 # NOTE(mandre) skip wsrep cluster status check
122 - KOLLA_KUBERNETES=True
126 - - 'DB_ROOT_PASSWORD'
129 expression: $.data.passwords.where($ != '').first()
132 - {get_param: MysqlRootPassword}
133 - {get_param: [DefaultPasswords, mysql_root_password]}
147 - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 2}' > /etc/puppet/hieradata/docker.json"
148 - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
150 TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation,galera_ready,mysql_database,mysql_grant,mysql_user'
151 CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::database::mysql_bundle'
154 - /etc/hosts:/etc/hosts:ro
155 - /etc/localtime:/etc/localtime:ro
156 - /etc/puppet:/tmp/puppet-etc:ro
157 - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
158 - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
159 - /dev/shm:/dev/shm:rw
160 - /var/lib/mysql:/var/lib/mysql:rw
162 - name: create /var/lib/mysql
167 - name: get bootstrap nodeid
169 command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
170 register: bootstrap_node
171 - name: set is_bootstrap_node fact
173 set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
174 - name: Disable the galera cluster resource
179 wait_for_resource: true
180 when: is_bootstrap_node
181 - name: Delete the stopped galera cluster resource.
186 wait_for_resource: true
187 when: is_bootstrap_node
188 - name: Disable mysql service
190 service: name=mariadb enabled=no