diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index 2f98d702a..641f96e02 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -136,6 +136,16 @@ write_priv: ".*" read_priv: ".*" no_log: true +- name: "Set mysql_username if environment variable mysql_user is set" + set_fact: + mysql_username: "{{ lookup('env', 'mysql_user') }}" + when: lookup('env', 'mysql_user') | length > 0 + no_log: true +- name: "Set mysql_password if environment variable mysql_pass is set" + set_fact: + mysql_password: "{{ lookup('env', 'mysql_pass') }}" + when: lookup('env', 'mysql_pass') | length > 0 + no_log: true - name: "MySQL - Creating DB" mysql_db: name: "ironic" diff --git a/releasenotes/notes/Add-env-var-support-for-mysql-user-password-3ac520eea7ea9807.yaml b/releasenotes/notes/Add-env-var-support-for-mysql-user-password-3ac520eea7ea9807.yaml new file mode 100644 index 000000000..868e88390 --- /dev/null +++ b/releasenotes/notes/Add-env-var-support-for-mysql-user-password-3ac520eea7ea9807.yaml @@ -0,0 +1,7 @@ +--- +features: + - Add support for passing a Mysql username and password + via environment variables mysql_user for username and + mysql_pass for password. Useful for cases where Mysql + server may be existing and have usernames with password + already set.