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
96 - /var/log/containers/mysql:/var/log/mariadb
97 command: ['/bin/bash', '-c', 'chown -R mysql:mysql /var/log/mariadb']
103 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
104 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
105 volumes: &mysql_volumes
106 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
107 - /var/lib/config-data/mysql/etc/my.cnf.d:/etc/my.cnf.d:ro
108 - /etc/localtime:/etc/localtime:ro
109 - /etc/hosts:/etc/hosts:ro
110 - /var/lib/mysql:/var/lib/mysql
111 - /var/log/containers/mysql:/var/log/mariadb
113 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
114 - KOLLA_BOOTSTRAP=True
115 # NOTE(mandre) skip wsrep cluster status check
116 - KOLLA_KUBERNETES=True
120 - - 'DB_ROOT_PASSWORD'
123 expression: $.data.passwords.where($ != '').first()
126 - {get_param: MysqlRootPassword}
127 - {get_param: [DefaultPasswords, mysql_root_password]}
133 volumes: *mysql_volumes
135 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
137 # MySQL database initialization occurs only on single node
139 config_volume: 'mysql_init_tasks'
140 puppet_tags: 'mysql_database,mysql_grant,mysql_user'
141 step_config: 'include ::tripleo::profile::base::database::mysql'
142 config_image: *mysql_image
144 - /var/lib/mysql:/var/lib/mysql/:ro
145 - /var/log/containers/mysql:/var/log/mariadb
146 - /var/lib/config-data/mysql/root:/root:ro #provides .my.cnf
148 - name: create persistent directories
153 - /var/log/containers/mysql
156 - name: Stop and disable mysql service
158 service: name=mariadb state=stopped enabled=no