ansible mysql-server installation , password issue

492 views
Skip to first unread message

Urgen Sherpa

unread,
Aug 29, 2014, 7:23:34 AM8/29/14
to ansible...@googlegroups.com
 Greetings!
I am new to ansible and im trying to install mysql-server  below is my playbook [im in a vmware10 using two centos 6.5 x64 machines one as ansible-Node and another as client]

---
- hosts: webservers
  gather_facts: False
    - name: install apache
      yum: name=httpd state=latest
    - name: install mysql
      yum: name=mysql-server state=installed

    - name: Install MySQL-python
      yum: name=MySQL-python state=installed


    - name: Ensure MySQL is running
      service: name=mysqld state=started enabled=true


the installation goes fine, but when i go to client node and try to do mysql_secure_installation  , even though i havent set any password , it shows access denied / password incorrect
[root@monitor1 ~]# service mysqld restart
Starting mysqld:                                           [  OK  ]
[root@monitor1 ~]# mysql_secure_installation
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 
Please help

Michael DeHaan

unread,
Aug 29, 2014, 8:03:52 AM8/29/14
to ansible...@googlegroups.com
Try searching for "mysql" on galaxy.ansible.com and you'll see a lot of roles that set up MySQL>

In this case it sounds like you have a MySQL specific config issue and it's not specifically an Ansible issue, but I agree it's not the best possible experience from the tool.

(Note that you'll really want to see this fully automated anyway, hence why I recommend researching MySQL roles.  Having to manually run the interactive step to configure it isn't the long term goal, etc)




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/585f5db7-0a84-458d-a728-2e988640e5a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Petr Sukharev

unread,
Aug 29, 2014, 1:11:27 PM8/29/14
to ansible...@googlegroups.com

 What is MySQL version?

If 5.6 - root password is placed in /root/.mysql_secure or same file and when you login first time with it into mysql server, it ask you to change password.

I have role to setup MySQL

For 5.3 - 5.5

Install packages, run mysql_install_db, generate password and place it into variable, generate unattended file like this:

<Empry line>

<Empry line>

PASSWORD

PASSWORD


and apply this file on server via  "cat unattended_file | mysql_secure_install"

Reply all
Reply to author
Forward
0 new messages