Problem with {{ mysql_root_password }}


I’ve run trellis server.yml on a fresh Digital Ocean Ububtu instance and I’m encountering this problem:

TASK: [mariadb | Set root user password] **************************************
fatal: [x.x.x.x.x] => One or more undefined variables: ‘mysql_root_password’ is undefined

I’m executing ansible-playbook -i hosts/staging server.yml. The “missing” variable is defined in group_vars/staging/main.yml so I do not see why the play would not pick it up.

I’m not experienced with Ansible, but shouldn’t group_vars/staging/main.yml be read when executing the playbook for hosts/staging ?

What might I be missing here?

In my case, the reason why the {{ mysql_root_password }} was not read correctly was that I added a new server called [droplet] to hosts/staging, at the same time I failed to include this new server in the “staging” group under [staging:children].

Perhaps it will help somebody.

1 Like