1 heat_template_version: pike
4 MySQL service deployment using puppet
9 default: 'tripleoupstream'
13 default: 'centos-binary-mariadb:latest'
17 description: Mapping of service endpoint -> protocol. Typically set
18 via parameter_defaults in the resource registry.
22 description: Mapping of service_name -> network name. Typically set
23 via parameter_defaults in the resource registry. This
24 mapping overrides those in ServiceNetMapDefaults.
31 description: Role name on which the service is applied
35 description: Parameters specific to the role
45 type: ../../../puppet/services/database/mysql.yaml
47 EndpointMap: {get_param: EndpointMap}
48 ServiceNetMap: {get_param: ServiceNetMap}
49 DefaultPasswords: {get_param: DefaultPasswords}
50 RoleName: {get_param: RoleName}
51 RoleParameters: {get_param: RoleParameters}
55 description: Containerized service MySQL using composable services.
57 service_name: {get_attr: [MysqlPuppetBase, role_data, service_name]}
60 - {get_attr: [MysqlPuppetBase, role_data, config_settings]}
61 # Set PID file to what kolla mariadb bootstrap script expects
62 - tripleo::profile::base::database::mysql::mysql_server_options:
64 pid-file: /var/lib/mysql/mariadb.pid
66 pid-file: /var/lib/mysql/mariadb.pid
67 step_config: &step_config
70 - - "['Mysql_datadir', 'Mysql_user', 'Mysql_database', 'Mysql_grant', 'Mysql_plugin'].each |String $val| { noop_resource($val) }"
71 - {get_attr: [MysqlPuppetBase, role_data, step_config]}
72 # BEGIN DOCKER SETTINGS #
75 puppet_tags: file # set this even though file is the default
76 step_config: *step_config
77 config_image: &mysql_image
80 - [ {get_param: DockerNamespace}, {get_param: DockerMysqlImage} ]
82 /var/lib/kolla/config_files/mysql.json:
83 command: /usr/bin/mysqld_safe
85 - path: /var/lib/mysql
89 # Kolla_bootstrap runs before permissions set by kolla_config
97 - /var/log/containers/mysql:/var/log/mariadb
98 command: ['/bin/bash', '-c', 'chown -R mysql:mysql /var/log/mariadb']
104 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
105 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
106 volumes: &mysql_volumes
107 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
108 - /var/lib/config-data/mysql/etc/my.cnf.d:/etc/my.cnf.d:ro
109 - /etc/localtime:/etc/localtime:ro
110 - /etc/hosts:/etc/hosts:ro
111 - /var/lib/mysql:/var/lib/mysql
112 - /var/log/containers/mysql:/var/log/mariadb
114 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
115 - KOLLA_BOOTSTRAP=True
116 # NOTE(mandre) skip wsrep cluster status check
117 - KOLLA_KUBERNETES=True
121 - - 'DB_ROOT_PASSWORD'
124 expression: $.data.passwords.where($ != '').first()
127 - {get_param: MysqlRootPassword}
128 - {get_param: [DefaultPasswords, mysql_root_password]}
134 volumes: *mysql_volumes
136 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
138 # MySQL database initialization occurs only on single node
140 config_volume: 'mysql_init_tasks'
141 puppet_tags: 'mysql_database,mysql_grant,mysql_user'
142 step_config: 'include ::tripleo::profile::base::database::mysql'
143 config_image: *mysql_image
145 - /var/lib/mysql:/var/lib/mysql/:ro
146 - /var/log/containers/mysql:/var/log/mariadb
147 - /var/lib/config-data/mysql/root:/root:ro #provides .my.cnf
149 - name: create persistent directories
154 - /var/log/containers/mysql
157 - name: Stop and disable mysql service
159 service: name=mariadb state=stopped enabled=no