Fix deployment when using Ansible 2.6.5
Due to a change of lower MySQL module from MySQLdb to pymsql, Ansible calls to mysql_db and mysql_user modules fail. See https://askubuntu.com/questions/\ 766334/cant-login-as-mysql-user-root-from-normal-\ user-account-in-ubuntu-16-04 link for more information. Change-Id: Iceb04d5285aa4fa7b2cff371ab22b0a011369028
This commit is contained in:
parent
1e19c45199
commit
4fcba7f246
@ -90,8 +90,14 @@
|
||||
when: lookup('env', 'mysql_pass') | length > 0
|
||||
no_log: true
|
||||
|
||||
- name: Setting MySQL socket fact
|
||||
set_fact:
|
||||
mysql_socket_path: "/var/run/{% if ansible_distribution | lower is search('suse') %}mysql/mysql.sock{% else %}mysqld/mysqld.sock{% endif %}"
|
||||
when: ansible_version.full is version_compare('2.6.5', '>=')
|
||||
|
||||
- name: "MySQL - Creating DB"
|
||||
mysql_db:
|
||||
login_unix_socket: "{{ mysql_socket_path | default(omit) }}"
|
||||
name: "{{ ironic.database.name }}"
|
||||
state: present
|
||||
encoding: utf8
|
||||
@ -102,6 +108,7 @@
|
||||
|
||||
- name: "MySQL - Creating user for Ironic"
|
||||
mysql_user:
|
||||
login_unix_socket: "{{ mysql_socket_path | default(omit) }}"
|
||||
name: "{{ ironic.database.username }}"
|
||||
password: "{{ ironic.database.password }}"
|
||||
priv: "{{ ironic.database.name }}.*:ALL"
|
||||
|
@ -13,8 +13,14 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
---
|
||||
- name: Setting MySQL socket fact
|
||||
set_fact:
|
||||
mysql_socket_path: "/var/run/{% if ansible_distribution | lower is search('suse') %}mysql/mysql.sock{% else %}mysqld/mysqld.sock{% endif %}"
|
||||
when: ansible_version.full is version_compare('2.6.5', '>=')
|
||||
|
||||
- name: "MySQL - Create database"
|
||||
mysql_db:
|
||||
login_unix_socket: "{{ mysql_socket_path | default(omit) }}"
|
||||
login_user: "{{ mysql_username }}"
|
||||
login_password: "{{ mysql_password }}"
|
||||
name: "{{ ironic_inspector.database.name }}"
|
||||
@ -24,6 +30,7 @@
|
||||
|
||||
- name: "MySQL - Create user for inspector"
|
||||
mysql_user:
|
||||
login_unix_socket: "{{ mysql_socket_path | default(omit) }}"
|
||||
login_user: "{{ mysql_username }}"
|
||||
login_password: "{{ mysql_password }}"
|
||||
name: "{{ ironic_inspector.database.username }}"
|
||||
|
@ -71,8 +71,14 @@
|
||||
when: lookup('env', 'mysql_pass') | length > 0
|
||||
no_log: true
|
||||
|
||||
- name: Setting MySQL socket fact
|
||||
set_fact:
|
||||
mysql_socket_path: "/var/run/{% if ansible_distribution | lower is search('suse') %}mysql/mysql.sock{% else %}mysqld/mysqld.sock{% endif %}"
|
||||
when: ansible_version.full is version_compare('2.6.5', '>=')
|
||||
|
||||
- name: "MySQL - Creating DB"
|
||||
mysql_db:
|
||||
login_unix_socket: "{{ mysql_socket_path | default(omit) }}"
|
||||
name: "{{ keystone.database.name }}"
|
||||
state: present
|
||||
encoding: utf8
|
||||
@ -83,6 +89,7 @@
|
||||
|
||||
- name: "MySQL - Creating user for keystone"
|
||||
mysql_user:
|
||||
login_unix_socket: "{{ mysql_socket_path | default(omit) }}"
|
||||
name: "{{ keystone.database.username }}"
|
||||
password: "{{ keystone.database.password }}"
|
||||
priv: "{{ keystone.database.name }}.*:ALL"
|
||||
|
Loading…
Reference in New Issue
Block a user