Марионетка не настраивает MySQL

У меня есть следующее Марионеточное использование класса puppetlabs/mysql модуль:

class hg_playground::makowals::brains::db {

class { '::mysql::client':
    package_name => 'mariadb',
}

$override_options = {
    'mysqld' => {
        'log-bin' => '',
        'server-id' => $mysql_server_id,
  }
}
class { '::mysql::server':
    package_name => 'mariadb-server',
    root_password           => 'TESTOWY',
    remove_default_accounts => true,
    override_options        => $override_options,
}

mysql_user { 'slave_user@localhost':
    ensure => 'present',
    password_hash => mysql_password('master_replication'),
}

mysql_grant { 'slave_user@localhost/*.*':
    ensure => 'present',
    options => ['GRANT'],
    privileges => ['REPLICATION SLAVE'],
    table => '*.*',
    user => 'slave_user@localhost',
}

mysql_database { 'somedb':
    ensure => 'present',
}
}

Что происходит, там

  • mariadb-сервер устанавливается правильно
  • пароль root к дб НЕ установлен
  • в /root/.my.cnf Я имею password='TESTOWY'
  • ни новый пользователь, ни база данных не создаются

Конечно, рабочий агент не производит ошибок. Как начать отлаживать в этой ситуации? Уведомления от выполнения класса не показывают ничего интересного:

notice  /Stage[main]/Mysql::Server::Install/Package[mysql-server]/ensure    created
notice  /Stage[main]/Mysql::Server::Config/File[mysql-config-file]/content  content changed '{md5}54dc3e561e817f9c0a376a58383eb013' to '{md5}ff09a4033f718f08f69da17f0aa86652'
notice  /Stage[main]/Mysql::Server::Service/Service[mysqld]/ensure  ensure changed 'stopped' to 'running'
notice  /Stage[main]/Mysql::Server::Root_password/File[/root/.my.cnf]/ensure    defined content as '{md5}042e1a46bc15a260a349dbbe1bac8e71'
0
задан 6 October 2015 в 16:01
2 ответа

I Я использую centos 5 , а mariadb отсутствует в основном репо, поэтому я не указал package_name , и я протестировал ваш класс и работает, единственное, что я добавил, требуется в класс mysql :: server , и я использовал класс mysql :: db для создания БД.

class hg_playground::makowals::brains::db {
class { '::mysql::client':
    package_name => 'mariadb',
}

$override_options = {
    'mysqld' => {
        'log-bin' => '',
        'server-id' => $mysql_server_id,
  }
}
class { '::mysql::server':
    package_name => 'mariadb-server',
    root_password           => 'TESTOWY',
    remove_default_accounts => true,
    override_options        => $override_options,
}

mysql_user { 'slave_user@localhost':
    ensure => 'present',
    password_hash => mysql_password('master_replication'),
}

mysql_grant { 'slave_user@localhost/*.*':
    ensure => 'present',
    options => ['GRANT'],
    privileges => ['REPLICATION SLAVE'],
    table => '*.*',
    user => 'slave_user@localhost',
}

mysql_database { 'somedb':
    ensure => 'present',
    require => Class['mysql::server']
  }
}

Вывод выполнения Puppet.

=> default: Notice: Compiled catalog for centos7.example.com in environment testing in 2.97 seconds
==> default: Notice: /Stage[main]/Mysql::Client::Install/Package[mysql_client]/ensure: created
==> default: Notice: /Stage[main]/Mysql::Server::Install/Package[mysql-server]/ensure: created
==> default: Notice: /Stage[main]/Mysql::Server::Config/File[mysql-config-file]/content: content changed '{md5}54dc3e561e817f9c0a376a58383eb013' to '{md5}40a2060d1d62cb5c3f33e5e74be19889'
==> default: Notice: /Stage[main]/Mysql::Server::Installdb/Exec[mysql_install_db]/returns: executed successfully
==> default: Notice: /Stage[main]/Mysql::Server::Service/Service[mysqld]/ensure: ensure changed 'stopped' to 'running'
==> default: Notice: /Stage[main]/Mysql::Server::Root_password/Mysql_user[root@localhost]/password_hash: defined 'password_hash' as '*416F1598B4E5F9CD0DBFC2E35867FA1F96EBF4F5'
==> default: Notice: /Stage[main]/Mysql::Server::Root_password/File[/root/.my.cnf]/ensure: defined content as '{md5}cd27be3d51dcd48e92de9df7e894accb'
==> default: Notice: /Stage[main]/Mysql::Server::Account_security/Mysql_user[root@127.0.0.1]/ensure: removed
==> default: Notice: /Stage[main]/Mysql::Server::Account_security/Mysql_user[root@::1]/ensure: removed
==> default: Notice: /Stage[main]/Mysql::Server::Account_security/Mysql_user[@localhost]/ensure: removed
==> default: Notice: /Stage[main]/Mysql::Server::Account_security/Mysql_user[root@centos7.example.com]/ensure: removed
==> default: Notice: /Stage[main]/Mysql::Server::Account_security/Mysql_user[@centos7.example.com]/ensure: removed
==> default: Notice: /Stage[main]/Mysql::Server::Account_security/Mysql_database[test]/ensure: removed
==> default: Notice: /Stage[main]/Hg_playground::Makowals::Brains::Db/Mysql_user[slave_user@localhost]/ensure: created
==> default: Notice: /Stage[main]/Hg_playground::Makowals::Brains::Db/Mysql_grant[slave_user@localhost/*.*]/privileges: privileges changed ['USAGE'] to 'REPLICATION SLAVE'
==> default: Notice: /Stage[main]/Hg_playground::Makowals::Brains::Db/Mysql_grant[slave_user@localhost/*.*]/options: defined 'options' as 'GRANT'
==> default: Notice: /Stage[main]/Hg_playground::Makowals::Brains::Db/Mysql_database[somedb]/ensure: created
0
ответ дан 24 November 2019 в 08:00

Ваш класс mysql :: server должен иметь атрибут package_name, который включает версию.

class{ 'mysql::server':
  package_name     => "mariadb-server-${mariadb_version}",
  ...
}

Используйте, например, apt-cache search mariadb-server , чтобы посмотреть, как выглядит имя пакета, при условии, что вы уже позаботились о добавлении версии репозитория, которая предоставляет то, что вам нужно. Существуют отдельные репозитории для разных семейств версий mariadb.

0
ответ дан 24 November 2019 в 08:00

Теги

Похожие вопросы