I used to define variables in the following way:

---
mysql:
  config:
    bind_address: 127.0.0.1
  root:
    password: ''
    remote_access: absent

This style of writing is appealing to read and non repititive. Inside the 
artifacts of the role I can reference such variables like {{ 
mysql.root.password }}. However I am not able to override those variables 
by referencing them the same way from other roles, playbooks or the 
console. It took me some hours to find out, that the access of complex 
variables is not conform all over Ansible, which mades me working with 
Ansible more difficult. Even If i declare hash_behavior as merge, following 
will not work:

ansible-playbook -e "role=thomass.mysql docker.ports=['3306'] 
mysql.config.bind_address=0.0.0.0 mysql.root.password=letmein 
mysql.root.remote_access=present" --ask-sudo-pass site.yml

Currently I define my variables the following way:

mysql_config_bindAddress: 127.0.0.1
mysql_root_password: ''
mysql_root_remoteAccess: absent
 

But this style is not as readable as the one from above and you have to 
repeat the whole thought path for every variable.

Is it worth to think about making the variable access to the upper variable 
definition uniform all over Ansible? Not just because of the better 
variable definition style but also because of the more intuitive usage of 
Ansible.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c3245c76-dd64-450d-b3db-ed2c2d665643%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to