1 heat_template_version: pike
4 MySQL service deployment using puppet
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.
33 description: Role name on which the service is applied
37 description: Parameters specific to the role
47 default: '/etc/ipa/ca.crt'
49 description: Specifies the default CA cert to use if TLS is used for
50 services in the internal network.
54 internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
59 type: ../../../puppet/services/database/mysql.yaml
61 EndpointMap: {get_param: EndpointMap}
62 ServiceData: {get_param: ServiceData}
63 ServiceNetMap: {get_param: ServiceNetMap}
64 DefaultPasswords: {get_param: DefaultPasswords}
65 RoleName: {get_param: RoleName}
66 RoleParameters: {get_param: RoleParameters}
70 description: Containerized service MySQL using composable services.
72 service_name: {get_attr: [MysqlPuppetBase, role_data, service_name]}
75 - {get_attr: [MysqlPuppetBase, role_data, config_settings]}
76 # Set PID file to what kolla mariadb bootstrap script expects
77 - tripleo::profile::base::database::mysql::mysql_server_options:
79 pid-file: /var/lib/mysql/mariadb.pid
81 pid-file: /var/lib/mysql/mariadb.pid
82 step_config: &step_config
85 - - "['Mysql_datadir', 'Mysql_user', 'Mysql_database', 'Mysql_grant', 'Mysql_plugin'].each |String $val| { noop_resource($val) }"
86 - {get_attr: [MysqlPuppetBase, role_data, step_config]}
87 # BEGIN DOCKER SETTINGS #
90 puppet_tags: file # set this even though file is the default
91 step_config: *step_config
92 config_image: &mysql_config_image {get_param: DockerMysqlConfigImage}
94 /var/lib/kolla/config_files/mysql.json:
95 command: /usr/bin/mysqld_safe
97 - source: "/var/lib/kolla/config_files/src/*"
100 preserve_properties: true
101 - source: "/var/lib/kolla/config_files/src-tls/*"
104 preserve_properties: true
107 - path: /var/lib/mysql
110 - path: /etc/pki/tls/certs/mysql.crt
113 - path: /etc/pki/tls/private/mysql.key
117 # Kolla_bootstrap runs before permissions set by kolla_config
120 image: &mysql_image {get_param: DockerMysqlImage}
124 - /var/log/containers/mysql:/var/log/mariadb
125 command: ['/bin/bash', '-c', 'chown -R mysql:mysql /var/log/mariadb']
131 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
132 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
133 volumes: &mysql_volumes
136 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
137 - /var/lib/config-data/puppet-generated/mysql/:/var/lib/kolla/config_files/src:ro
138 - /etc/localtime:/etc/localtime:ro
139 - /etc/hosts:/etc/hosts:ro
140 - /var/lib/mysql:/var/lib/mysql
141 - /var/log/containers/mysql:/var/log/mariadb
143 - internal_tls_enabled
147 - - {get_param: InternalTLSCAFile}
148 - {get_param: InternalTLSCAFile}
150 - /etc/pki/tls/certs/mysql.crt:/var/lib/kolla/config_files/src-tls/etc/pki/tls/certs/mysql.crt:ro
151 - /etc/pki/tls/private/mysql.key:/var/lib/kolla/config_files/src-tls/etc/pki/tls/private/mysql.key:ro
154 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
155 - KOLLA_BOOTSTRAP=True
156 # NOTE(mandre) skip wsrep cluster status check
157 - KOLLA_KUBERNETES=True
161 - - 'DB_ROOT_PASSWORD'
164 expression: $.data.passwords.where($ != '').first()
167 - {get_param: MysqlRootPassword}
168 - {get_param: [DefaultPasswords, mysql_root_password]}
174 volumes: *mysql_volumes
176 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
178 # MySQL database initialization occurs only on single node
180 config_volume: 'mysql_init_tasks'
181 puppet_tags: 'mysql_database,mysql_grant,mysql_user'
182 step_config: 'include ::tripleo::profile::base::database::mysql'
183 config_image: *mysql_config_image
187 - /var/lib/mysql:/var/lib/mysql/:ro
188 - /var/log/containers/mysql:/var/log/mariadb
189 - /var/lib/config-data/mysql/root:/root:ro #provides .my.cnf
191 - internal_tls_enabled
195 - - {get_param: InternalTLSCAFile}
196 - {get_param: InternalTLSCAFile}
198 - /etc/pki/tls/certs/mysql.crt:/var/lib/kolla/config_files/src-tls/etc/pki/tls/certs/mysql.crt:ro
199 - /etc/pki/tls/private/mysql.key:/var/lib/kolla/config_files/src-tls/etc/pki/tls/private/mysql.key:ro
202 get_attr: [MysqlPuppetBase, role_data, metadata_settings]
204 - name: create persistent directories
209 - /var/log/containers/mysql
212 - name: Stop and disable mysql service
214 service: name=mariadb state=stopped enabled=no