From 6842a3cdc6c7ef625316696b538dd7d75ec088c0 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Tue, 9 Jan 2018 15:56:27 +0100 Subject: [PATCH] Set password for mysql root user on undercloud The port is firewalled off by default so mysql is not reachable except to localhost users. In any case it is good to set a password for the mysql root user. We are 'reusing' the user_db_password parameter, because it is actually unused, instead of adding yet another parameter. Tested this change against an existing undercloud and observed that the mysql root user got a correct password and that the /root/.my.cnf file got generated. Closes-Bug: #1742191 Change-Id: I408ce3a0fe2ab8e86bcc280256cdb51688efde75 (cherry picked from commit 955c339af3ddf040fab4a153f1e6c249aefe0989) --- elements/puppet-stack-config/puppet-stack-config.yaml.template | 1 + instack_undercloud/undercloud.py | 2 +- undercloud.conf.sample | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/elements/puppet-stack-config/puppet-stack-config.yaml.template b/elements/puppet-stack-config/puppet-stack-config.yaml.template index e486d77ee..dc5005cce 100644 --- a/elements/puppet-stack-config/puppet-stack-config.yaml.template +++ b/elements/puppet-stack-config/puppet-stack-config.yaml.template @@ -218,6 +218,7 @@ tripleo::profile::base::database::mysql::mysql_server_options: bind-address: "%{hiera('controller_host')}" innodb_file_per_table: 'ON' mysql::server::restart: true +mysql::server::root_password: {{UNDERCLOUD_DB_PASSWORD}} # Neutron neutron::bind_host: {{LOCAL_IP}} diff --git a/instack_undercloud/undercloud.py b/instack_undercloud/undercloud.py index 7d8787474..bedd8ddf8 100644 --- a/instack_undercloud/undercloud.py +++ b/instack_undercloud/undercloud.py @@ -336,7 +336,7 @@ _opts = [ # Passwords, tokens, hashes _auth_opts = [ cfg.StrOpt('undercloud_db_password', - help=('Password used for MySQL databases. ' + help=('Password used for MySQL root user. ' 'If left unset, one will be automatically generated.') ), cfg.StrOpt('undercloud_admin_token', diff --git a/undercloud.conf.sample b/undercloud.conf.sample index 9f717f506..2004dd1d0 100644 --- a/undercloud.conf.sample +++ b/undercloud.conf.sample @@ -185,7 +185,7 @@ # From instack-undercloud # -# Password used for MySQL databases. If left unset, one will be +# Password used for MySQL root user. If left unset, one will be # automatically generated. (string value) #undercloud_db_password =