1 heat_template_version: pike
4 MySQL service deployment using puppet
9 default: 'tripleoupstream'
13 default: 'centos-binary-mariadb:latest'
15 DockerMysqlConfigImage:
16 description: The container image to use for the mysql config_volume
17 default: 'centos-binary-mariadb:latest'
21 description: Mapping of service endpoint -> protocol. Typically set
22 via parameter_defaults in the resource registry.
26 description: Mapping of service_name -> network name. Typically set
27 via parameter_defaults in the resource registry. This
28 mapping overrides those in ServiceNetMapDefaults.
35 description: Role name on which the service is applied
39 description: Parameters specific to the role
49 type: ../../../puppet/services/database/mysql.yaml
51 EndpointMap: {get_param: EndpointMap}
52 ServiceNetMap: {get_param: ServiceNetMap}
53 DefaultPasswords: {get_param: DefaultPasswords}
54 RoleName: {get_param: RoleName}
55 RoleParameters: {get_param: RoleParameters}
59 description: Containerized service MySQL using composable services.
61 service_name: {get_attr: [MysqlPuppetBase, role_data, service_name]}
64 - {get_attr: [MysqlPuppetBase, role_data, config_settings]}
65 # Set PID file to what kolla mariadb bootstrap script expects
66 - tripleo::profile::base::database::mysql::mysql_server_options:
68 pid-file: /var/lib/mysql/mariadb.pid
70 pid-file: /var/lib/mysql/mariadb.pid
71 step_config: &step_config
74 - - "['Mysql_datadir', 'Mysql_user', 'Mysql_database', 'Mysql_grant', 'Mysql_plugin'].each |String $val| { noop_resource($val) }"
75 - {get_attr: [MysqlPuppetBase, role_data, step_config]}
76 # BEGIN DOCKER SETTINGS #
79 puppet_tags: file # set this even though file is the default
80 step_config: *step_config
81 config_image: &mysql_config_image
84 - [ {get_param: DockerNamespace}, {get_param: DockerMysqlConfigImage} ]
86 /var/lib/kolla/config_files/mysql.json:
87 command: /usr/bin/mysqld_safe
89 - path: /var/lib/mysql
93 # Kolla_bootstrap runs before permissions set by kolla_config
99 - [ {get_param: DockerNamespace}, {get_param: DockerMysqlImage} ]
103 - /var/log/containers/mysql:/var/log/mariadb
104 command: ['/bin/bash', '-c', 'chown -R mysql:mysql /var/log/mariadb']
110 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
111 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
112 volumes: &mysql_volumes
113 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
114 - /var/lib/config-data/mysql/etc/my.cnf.d:/etc/my.cnf.d:ro
115 - /etc/localtime:/etc/localtime:ro
116 - /etc/hosts:/etc/hosts:ro
117 - /var/lib/mysql:/var/lib/mysql
118 - /var/log/containers/mysql:/var/log/mariadb
120 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
121 - KOLLA_BOOTSTRAP=True
122 # NOTE(mandre) skip wsrep cluster status check
123 - KOLLA_KUBERNETES=True
127 - - 'DB_ROOT_PASSWORD'
130 expression: $.data.passwords.where($ != '').first()
133 - {get_param: MysqlRootPassword}
134 - {get_param: [DefaultPasswords, mysql_root_password]}
140 volumes: *mysql_volumes
142 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
144 # MySQL database initialization occurs only on single node
146 config_volume: 'mysql_init_tasks'
147 puppet_tags: 'mysql_database,mysql_grant,mysql_user'
148 step_config: 'include ::tripleo::profile::base::database::mysql'
149 config_image: *mysql_config_image
151 - /var/lib/mysql:/var/lib/mysql/:ro
152 - /var/log/containers/mysql:/var/log/mariadb
153 - /var/lib/config-data/mysql/root:/root:ro #provides .my.cnf
155 - name: create persistent directories
160 - /var/log/containers/mysql
163 - name: Stop and disable mysql service
165 service: name=mariadb state=stopped enabled=no