1 heat_template_version: ocata
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.
37 type: ../../../puppet/services/database/mysql.yaml
39 EndpointMap: {get_param: EndpointMap}
40 ServiceNetMap: {get_param: ServiceNetMap}
41 DefaultPasswords: {get_param: DefaultPasswords}
45 description: Containerized service MySQL using composable services.
47 service_name: {get_attr: [MysqlPuppetBase, role_data, service_name]}
50 - {get_attr: [MysqlPuppetBase, role_data, config_settings]}
51 # Set PID file to what kolla mariadb bootstrap script expects
52 - tripleo::profile::base::database::mysql::mysql_server_options:
54 pid-file: /var/lib/mysql/mariadb.pid
56 pid-file: /var/lib/mysql/mariadb.pid
57 step_config: &step_config
60 - - "['Mysql_datadir', 'Mysql_user', 'Mysql_database', 'Mysql_grant', 'Mysql_plugin'].each |String $val| { noop_resource($val) }"
61 - {get_attr: [MysqlPuppetBase, role_data, step_config]}
62 # BEGIN DOCKER SETTINGS #
65 puppet_tags: file # set this even though file is the default
66 step_config: *step_config
67 config_image: &mysql_image
70 - [ {get_param: DockerNamespace}, {get_param: DockerMysqlImage} ]
72 /var/lib/kolla/config_files/mysql.json:
73 command: /usr/bin/mysqld_safe
75 - dest: /etc/mysql/my.cnf
76 source: /var/lib/kolla/config_files/src/etc/my.cnf
79 - dest: /etc/my.cnf.d/galera.cnf
80 source: /var/lib/kolla/config_files/src/etc/my.cnf.d/galera.cnf
91 # Kolla does only non-recursive chown
92 command: ['chown', '-R', 'mysql:', '/var/lib/mysql']
94 - /var/lib/mysql:/var/lib/mysql
100 # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
101 command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
102 volumes: &mysql_volumes
103 - /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
104 - /var/lib/config-data/mysql/:/var/lib/kolla/config_files/src:ro
105 - /etc/localtime:/etc/localtime:ro
106 - /etc/hosts:/etc/hosts:ro
107 - /var/lib/mysql:/var/lib/mysql
109 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
110 - KOLLA_BOOTSTRAP=True
111 # NOTE(mandre) skip wsrep cluster status check
112 - KOLLA_KUBERNETES=True
116 - - 'DB_ROOT_PASSWORD'
119 expression: $.data.passwords.where($ != '').first()
122 - {get_param: MysqlRootPassword}
123 - {get_param: [DefaultPasswords, mysql_root_password]}
129 volumes: *mysql_volumes
131 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
133 # MySQL database initialization occurs only on single node
135 config_volume: 'mysql_init_tasks'
136 puppet_tags: 'mysql_database,mysql_grant,mysql_user'
137 step_config: 'include ::tripleo::profile::base::database::mysql'
141 - [ {get_param: DockerNamespace}, {get_param: DockerMysqlImage} ]
143 - "/var/lib/mysql:/var/lib/mysql/:ro"
144 - "/var/lib/config-data/mysql/root:/root:ro" #provides .my.cnf
146 - name: create /var/lib/mysql
151 - name: Stop and disable mysql service
153 service: name=mariadb state=stopped enabled=no