Don't run ansible tag or role in vagrant provision because of - name: Set root user password errors

I’d like to exclude

{ role: mariadb, tags: [mariadb], when: not mysql_remote_database }

when I run vagrant provision instead of vagrant up, because I get some errors with

- name: Set root user password
 ...
- name: Delete anonymous MySQL server users
 ...
- name: Remove the test database
 ...

Error msg:

msg: unable to connect to database, check login_user and login_password are correct

You can just fix that error from ever happening again. I’m assuming you’re running this on a previously provisioned server?

See these two comments:

https://github.com/roots/trellis/pull/239#issuecomment-124943399 and https://github.com/roots/trellis/pull/239#issuecomment-133954971

Hi @swalkinshaw

no this a brand new trellis with bedrock - both from the commits last friday

Well can you help us by providing the steps you did? Or any changes/customizations?

  1. I’m assuming you edited some files first?
  2. You ran vagrant up?
  3. Then you tried to run vagrant provision after?

What exact commit of Trellis are you using? What versions of Ansible and Vagrant? Are you using OS X or Windows?

Anything else different you’ve done? We try to help people out but it’s hard when there isn’t much information to go on.

@swalkinshaw
it’s OS X 10.10.5
Commit https://github.com/roots/trellis/commit/2b4b602f1963733f96eceb233f859b668b49cb48
Ansible 1.9.2

I just edited the wordpress_sites.yml in the dev

# Documentation: https://github.com/roots/trellis#wordpress-sites
wordpress_sites:
  local.matrix42.com:
    site_hosts:
      - local.matrix42.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:Matrix42AG/_marketplace-bedrock.git
    site_install: true
    site_title: DEV EN
    admin_user: admin
    admin_password: admin
    admin_email: admin@example.dev
    multisite:
      enabled: true
      subdomains: false
    ssl:
      enabled: true
    cache:
      enabled: false
      duration: 30s
    system_cron: true
    env:
      wp_home: https://local.matrix42.com
      wp_siteurl: https://local.matrix42.com/wp
      wp_env: development
      db_charset: utf8mb4
      db_name: usr_p262656_1
      db_user: root
      db_password: devpw
      domain_current_site: local.matrix42.com

It’s because you’re using root as the db_user which you should not do.

Trellis creates a MySQL user specifically for that WP site database. You should be using something like this:

db_name: local_matrix42
db_user: matrix42
db_password: whatever