Hello

I have the following directory and I run ansible 2.4.1.0 with python 2.7 , 
on Redhat 6/7 server

inventories/
   production/
      hosts.prod     # inventory file 
      group_vars/
         all
      host_vars/
 
   dev/
      hosts.dev     # inventory file     
      group_vars/
         all
      host_vars/
         stagehost1  
         stagehost2  
         
    roles/
       common_configuration
          tasks/
             main.yml
          vars/
             main.yml
      
     playbook/
        all.yml

for the role common_configuration

my task is

- name: set timezone , default to Europe/verlin but can be override by 
inventory
  timezone:
    name: "{{ timezone }}"
  notify:
    - restart crond

and my variable in the role is 
timezone: Europe/verlin

( I konw this value is not a legit timezone but it's for testing purpose) 



In my dev inventory, I set in all.yml the variable with a different string.

timezone: Europe/Paris


Here how I call my playbook

 ansible-playbook -u lebrett-adm -k --become -i 
/etc/ansible/inventories/dev/hosts.dev playbook/all.yml --limit matching

As far I understand variable precedence ,  role variable should be 
overriden by inventory . But in my case , it stay with role variable.


TASK [common_configuration : set timezone , default to Europe/Paris but can 
be override by inventory] 
*************************************************************************************************
fatal: [srvamsdev-mat02]: FAILED! => {"changed": false, "failed": true, 
"msg": "Error message:\ngiven timezone \"Europe/verlin\" is not available"}
fatal: [srvamsdev-mat01]: FAILED! => {"changed": false, "failed": true, 
"msg": "Error message:\ngiven timezone \"Europe/verlin\" is not available"}
        to retry, use: --limit @/etc/ansible/playbook/all.retry


For testing, I have deleted variable in role and ansible use variable in my 
dev inventory.

Am i doing something wrong ?

Regards

Thibaud LEBRET

-- 
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/0b73a0e7-d0a4-41fa-b3f8-e28ce9517bd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to