Allow mysql_username and mysql_password to be passed via env var.

This change allows mysql_username and mysql_password to be passed to
bifrost-ironic-install via the environment variables mysql_user and
mysql_pass. This is useful when there is a preexisting mysql installation
with passwords alreay set.

Change-Id: I6dfd3ec0e769f0af6b157cde106885eabc24d120
This commit is contained in:
Chris Krelle 2016-03-16 14:50:47 -07:00
parent d4e765189c
commit ae5e64ba80
2 changed files with 17 additions and 0 deletions

View File

@ -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"

View File

@ -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.