Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] Issues while using ansible mysql_db and mysql_user modules #312

Open
adityaprakash-bobby opened this issue Dec 18, 2019 · 0 comments

Comments

@adityaprakash-bobby
Copy link

adityaprakash-bobby commented Dec 18, 2019

Problem: While creating a sandbox for testing the ansible scripts along with self-written roles, the kitchen environment that is bootstrapped using vagrant(or even docker) as the driver is not able to perform few actions on the VM. This behavior doesn't seem to be shown when I provision a VM using a basic Vagrantfile and vagrant up command.

Below is the kitchen.yml file:

---
driver:
  name: vagrant
  customize:
    audio: none

provisioner:
  name: ansible_playbook
  playbook: playbook.yml
  hosts: all
  require_chef_for_busser: false
  require_ruby_for_busser: true
platforms:
  - name: ubuntu
    driver_config:
      box: "ubuntu/xenial64"
suites:
  - name: default

verifier:
  ruby_bindir: '/usr/bin'

Upon kitchen create the error is as follows (it seems that mysql_* modules are not working properly and it is not using /root/.my.cnf file as it is supposed to. This works perfectly fine when it is directly provisioned):

TASK [adityaprakash_bobby.ansible_role_wordpress : Create wordpress mysql database] ***
       fatal: [localhost]: FAILED! => {"changed": false, "msg": "unable to connect to database: (1045, u\"Access denied for user 'root'@'localhost' (using password: NO)\")"}
       
       PLAY RECAP *********************************************************************
       localhost                  : ok=17   changed=1    unreachable=0    failed=1    skipped=6    rescued=0    ignored=0   
       
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-ubuntu>.  Please see .kitchen/logs/default-ubuntu.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

The task for mysql_db is as follows:

- mysql_db:
    name: wordpress
    state: present

The Gemfile is:

source 'https://rubygems.org'
gem 'test-kitchen', '~> 1.0'
gem 'kitchen-ansible'
gem 'kitchen-docker'
gem 'kitchen-vagrant'
gem 'serverspec'

Even I tried the walk-around in #2 , even that didn't seem to work. Anything that I can be going wrong in the kitchen.yml file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant