error message when trying to create mariadb databse

25 views
Skip to first unread message

Eff Ggl

unread,
Feb 4, 2015, 4:04:10 PM2/4/15
to ansible...@googlegroups.com
I am trying to install mysql using ANSIBLE on CentOS7(i have no idea why every documention in the world now ONLY talks ablotu Ubuntu and NO CentOS anymore...really SAD!)

here is my create_db.yml file

---
- name: Install Python MySQLdb
  yum: name=MySQL-python state=latest

- name: Create the Drupal database
  mysql_db: db={{ db_name }} state=present

- name: Create the Drupal user
  mysql_user: >
    name={{ db_user }}
    password={{ db_password }}
    priv={{ db_name }}.*:ALL
    host=localhost


ALSO here is my setup.yml file

---

- name: Install MySQL server
  yum: name=mariadb-server state=latest

- name: Install php apache modules
  yum: name=php-gd state=latest

- name: Install php apache modules
  yum: name=php-ldap state=latest

- name: Install php apache modules
  yum: name=php-odbc state=latest

- name: Install php apache modules
  yum: name=php-pear state=latest

- name: Install php apache modules
  yum: name=php-xml state=latest

- name: Install php apache modules
  yum: name=php-xmlrpc state=latest

- name: Install php apache modules
  yum: name=php-mbstring state=latest

- name: Install php apache modules
  yum: name=php-snmp state=latest

- name: Install php apache modules
  yum: name=php-soap state=latest

- name: Install php apache modules
  yum: name=curl state=latest

- name: Install php apache modules
  yum: name=curl-devel state=latest

- name: Install MySQL module for PHP
  yum: name=php-mysql state=latest


NOW when ansible is running to install it, here is the error i get

TASK: [mysql | Install MySQL server] ******************************************
ok: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
ok: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
ok: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
ok: [ansiblev1]

TASK: [mysql | Install php apache modules] ************************************
changed: [ansiblev1]

TASK: [mysql | Install MySQL module for PHP] **********************************
changed: [ansiblev1]

TASK: [mysql | Install Python MySQLdb] ****************************************
changed: [ansiblev1]

TASK: [mysql | Create the Drupal database] ************************************
failed: [ansiblev1] => {"failed": true}
msg: unable to connect, check login_user and login_password are correct, or alternatively check ~/.my.cnf contains credentials

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/home/bbusari/site.retry

ansiblev1                  : ok=18   changed=10   unreachable=0    failed=1



What do i do to resolve this?
Running CentOS 7 and ansible-1.8.2-1.el7.noarch

Thanks




Giovanni Tirloni

unread,
Feb 5, 2015, 5:47:41 AM2/5/15
to ansible...@googlegroups.com
On Wed, 04 Feb 2015 13:04 -0800, Eff Ggl <thereal...@gmail.com>
wrote:
> TASK: [mysql | Create the Drupal database]
> ************************************
> failed: [ansiblev1] => {"failed": true}
> msg: unable to connect, check login_user and login_password are correct,
> or
> alternatively check ~/.my.cnf contains credentials

Have you installed MySQL before and changed the password? If so, specify
the user/password with privileges to create databases.

- name: Install Python MySQLdb
yum:
name: MySQL-python
state: latest

- name: Create the Drupal database
mysql_db:
name: db_name
login_user: XXX
login_password: XXX
state: present

- name: Create the Drupal user
mysql_user:
name: db_user
password: db_password
priv: "{{ db_name }}.*:ALL"
host: localhost

You can simplify your setup.yml playbook too:

- name: Install packages
yum:
name: "{{ item }}"
state: latest
with_items:
- mariadb-server
- php-gd
- php-ldap
- php-odbc
- php-pear
- php-xml
- php-xmlrpc
- php-mbstring
- php-snmp
- php-soap
- curl
- curl-devel
- php-mysql

Giovanni
Reply all
Reply to author
Forward
0 new messages