Error with Mariadb : Set root user password task when re-provisioning

I have a local Trellis setup that is working and I’ve successfully provisioned and deployed my staging and production websites (Digital Ocean droplets). When I try to re-provision one of my servers, I keep running into an error while it’s executing the mariadb : Set root user password task. When I run all other tasks by running the playbook with a bunch of tags, re-provisioning works just fine.

TASK [mariadb : Set root user password] ***************************************************************************************************************************************************************************
System info:
  Ansible 2.9.0; Linux
  Trellis Head
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [deleted for privacy reasons] (item=deleted for privacy reasons) => {"ansible_loop_var": "item", "changed": false, "item": "deleted for privacy reasons"}
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [deleted for privacy reasons] (item=127.0.0.1) => {"ansible_loop_var": "item", "changed": false, "item": "127.0.0.1"}
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [deleted for privacy reasons] (item=::1) => {"ansible_loop_var": "item", "changed": false, "item": "::1"}
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [deleted for privacy reasons] (item=localhost) => {"ansible_loop_var": "item", "changed": false, "item": "localhost"}

I pulled in a new set of Trellis config files and changed the bare minimum. Provisioning was once again successful, but re-provisioning failed on the same MariaDB task.

group_vars/staging/wordpress_sites.yml:

wordpress_sites:
  staging.website.nl:
    site_hosts:
      - canonical: staging.website.nl
        # redirects:
        #   - otherdomain.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@gitlab.com:account/website.nl.git # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: letsencrypt
    cache:
      enabled: false

group_vars/staging/vault.yml:

# Documentation: https://roots.io/trellis/docs/vault/
vault_mysql_root_password: stagingpw

# Documentation: https://roots.io/trellis/docs/security/
vault_users:
  - name: "{{ admin_user }}"
    password: example_password
    salt: "generateme"

# Variables to accompany `group_vars/staging/wordpress_sites.yml`
# Note: the site name (`example.com`) must match up with the site name in the above file.
vault_wordpress_sites:
  staging.website.nl:
    env:
      db_password: example_dbpassword
      # Generate your keys here: https://roots.io/salts.html
      auth_key: "generateme"
      secure_auth_key: "generateme"
      logged_in_key: "generateme"
      nonce_key: "generateme"
      auth_salt: "generateme"
      secure_auth_salt: "generateme"
      logged_in_salt: "generateme"
      nonce_salt: "generateme"

Appreciate any help in the matter, thanks!

:thinking: strange.

What does group_vars/staging/main.yml look like? It should have

mysql_root_password: "{{ vault_mysql_root_password }}" # Define this variable in group_vars/staging/vault.yml

I left group_vars/staging/main.yml alone. The content right now is:

mysql_root_password: "{{ vault_mysql_root_password }}" # Define this variable in group_vars/staging/vault.yml

Hello, I’m getting the same error.

System info:
  Ansible 2.9.0; Vagrant 2.2.6; Linux
  Trellis Head
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [default] (item=default) => {"ansible_loop_var": "item", "changed": false, "item": "default"}
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [default] (item=127.0.0.1) => {"ansible_loop_var": "item", "changed": false, "item": "127.0.0.1"}
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [default] (item=::1) => {"ansible_loop_var": "item", "changed": false, "item": "::1"}
---------------------------------------------------
unable to connect to database: (1045, "Access denied for user
'root'@'localhost' (using password: NO)")
failed: [default] (item=localhost) => {"ansible_loop_var": "item", "changed": false, "item": "localhost"}

Is there any solution to this?

Once I downgraded the Ansible from version 2.9.0 to 2.7.13, I got it fixed.

2 Likes

Ansible 2.9 isn’t officially supported by Trellis anyway.

There’s an issue to track this Ansible bug as well: https://github.com/roots/trellis/issues/1119

1 Like

Downgrading Ansible also fixed my problem. Thanks @Dilip7597!

I am having the same issue.

I succesfully provisioned using this:

SKIP_GALAXY=true ANSIBLE_TAGS=wordpress vagrant provision

Downgrading dependency (Ansible) shouldn’t be the solution …
Can someone from Roots team (or contributors) look into that? Is there a reason for not supporting Ansible 2.9, and, will that change in the future?
I would like to contribute here, but this is above my pay grade :wink:

EDIT: ok, I see it’s a Ansible issue … sorry, Roots folks :slight_smile:

This topic was automatically closed after 42 days. New replies are no longer allowed.