Closed dixhuit closed 9 years ago
Is this still a problem Dan? I was able to change my database name from 'vladdb' without any trouble. Maybe I fixed it during my updates over the new year and didn't comment here?
No idea. Hope so. Will test and report back...
Weird, I'm still able to replicate this.
I'm juggling too many things right this second but when I get a chance, I'll try some some varied tests and hopefully get to the bottom of it.
I can confirm the bug.
Righto. Assuming we're all running Vlad latest dev, I suggest we all post the output of the following string of commands to see if there are any obvious clues:
echo "VirtualBox `VBoxManage --version`"; vagrant --version; ansible --version; vagrant plugin list
VirtualBox 4.3.20r96996 Vagrant 1.6.5 ansible 1.8.2 configured module search path = None vagrant-cachier (1.1.0) vagrant-login (1.0.1, system) vagrant-share (1.1.4, system) vagrant-triggers (0.5.0))
Spent a little time today trying to debug this on latest dev. I added the following debug task to various places in the mysql role:
- name: Debugging dbname [description of where the task has been inserted]
debug: var=dbname
This was added at the top & bottom of both tasks/main.yml and tasks/debian_mysql.yml. I also added it before and after the "create application database" task in tasks/debian_mysql.yml.
I then configured my (outer) settings file as follows:
---
# Outer settings file
# Synced folders
host_synced_folder: "../docroot"
aux_synced_folder: "../vlad_aux"
# Install components:
mailcatcher_install: false
pimpmylog_install: false
ruby_install: false
sendmail_install: false
varnish_install: false # If you turn this off then make sure you set the http_port to be 80.
# Provision with custom playbooks
custom_provision: true
# HTTP port for the web server. If you have turned off Varnish then you might want to set this to "80"
http_port: 80
# Install PECL uploadprogress
php_pecl_uploadprogress: false
# Add RSA or DSA identity from host to guest on 'vagrant up'.
use_host_id: true
# Set the level of verbosity that Ansible will use
# This can be one of "", "v", "vv", "vvv", or "vvvv"
ansible_verbosity: "v"
# CPUs and memory to be allocated to the guest VM from the host machine
vm_cpus: "auto"
vm_memory: "auto"
# MySQL
dbname: nosferatu
Some of that config is probably irrelevant but I want to be thorough here for the sake of not missing anything. The really important part is dbname: nosferatu
- that should (and certainly used to) override Vlad's default of vladdb
which is set in the mysql role's vars/main.yml.
After provisioning the VM with these settings I then searched the ansible.log for Debugging dbname
. Every returned variable from my debug task was vladdb
.
@philipnorton42 When you get a spare minute (I know, they don't exist) would you mind trying this test and posting back with your results? Below is a patch for convenience (it just adds in the debug tasks to 2 files as described above):
Index: vlad/playbooks/roles/mysql/tasks/main.yml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vlad/playbooks/roles/mysql/tasks/main.yml (revision 818da54f4fcc9198bd5f8f4cf2cf2c5bfc7a3ebc)
+++ vlad/playbooks/roles/mysql/tasks/main.yml (revision )
@@ -1,4 +1,8 @@
---
+
+- name: Debugging dbname at the beginning of the mysql role
+ debug: var=dbname
+
- name: get local IPv4 address
local_action: setup filter=ansible_default_ipv4
register: local_ipv4_address
@@ -10,4 +14,7 @@
when: ansible_os_family == "Debian"
- include: redhat_mysql.yml
- when: ansible_os_family == "RedHat"
\ No newline at end of file
+ when: ansible_os_family == "RedHat"
+
+- name: Debugging dbname at the end of the mysql role
+ debug: var=dbname
Index: vlad/playbooks/roles/mysql/tasks/debian_mysql.yml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vlad/playbooks/roles/mysql/tasks/debian_mysql.yml (revision 818da54f4fcc9198bd5f8f4cf2cf2c5bfc7a3ebc)
+++ vlad/playbooks/roles/mysql/tasks/debian_mysql.yml (revision )
@@ -1,4 +1,8 @@
---
+
+- name: Debugging dbname at the beginning of debian_mysql.yml
+ debug: var=dbname
+
- name: install mysql packages
apt: pkg={{ item }} state=installed
sudo: true
@@ -86,6 +90,9 @@
- name: remove the MySQL test database
mysql_db: db=test state=absent login_user=root login_password={{ mysql_root_password }}
+- name: Debugging dbname at just before "create application database" in debian_mysql.yml
+ debug: var=dbname
+
# set up default database
- name: create application database
mysql_db: name={{ dbname }} state=present login_password={{ mysql_root_password }} login_user=root collation=utf8_general_ci
@@ -110,3 +117,6 @@
when: db_import_up != true and db_import_up != false
ignore_errors: yes
tags: mysql_import
+
+- name: Debugging dbname at the end of debian_mysql.yml
+ debug: var=dbname
I'm working on another Ansible project and just (re)realised the significance of [rolename]/vars/
vs [rolename]/defaults/
. Thought I'd give that a whirl in Vlad to hopefully fix this bug, pulled latest dev and then spotted https://github.com/hashbangcode/vlad/commit/8486dd307c7bceff7bd8c9d1d44adc2f2253a628 which may have already addressed the issue (this may explain why @philipnorton42 was having problems reproducing this). Am testing right now to see if we can close this...
Yep, this appears to be fixed. Top work! Closing.
Using latest dev it seems that I can no longer override the value of the
dbname
variable via my settings file; Vlad seems to always use the default value "vladdb" (set in the mysql role).I'm defaulting to Ubuntu 12 so this is the debian_mysql.yml playbook we're talking about here. Glancing over the code, I can't see anything wrong:
In the meantime I can side step this my just using vladdb as my db name (I'm running a VM per site so this isn't a problem) but obviously we should get to the bottom of this before we tag another master.