I think I found the most weird bug that was driving me crazy, it seems for 
some strange reason when you have in your playbook vars_files with the name 
based on a variable the ansible_fqdn keeps the old value...

Here are all the steps to reproduce it in ansible 1.7.1 :

create the bellow 3 files exactly as they are (var_test.yml 
, inv_test, test.yml) :

1) *var_test.yml* :
TEST: "HELLO"

2) *inv_test* :
[all:vars]
VAR_FILE=var_test

[test]
test

3) *test.yml* :
---
- hosts: localhost
  vars_files:
  *  - "{{ VAR_FILE }}.yml"*

  tasks:

    - name: show inventory_hostname
      debug: msg="inventory_hostname is  {{ inventory_hostname }}"

    - name: show ansible_fqdn
      debug: msg="ansible_fqdn is  {{ ansible_fqdn }}"

    - name: set ansible_fqdn fact
      set_fact: ansible_fqdn={{ inventory_hostname }}

    - name: show ansible_fqdn
      debug: msg="ansible_fqdn is  {{ ansible_fqdn }}"


4) run ->  ansible-playbook -i inv_test  test.yml -v 


if you replace the *- "{{ VAR_FILE }}.yml" *with  *- var_test.yml *it will 
work
if the *var_test.yml *is empty it will work  


Regards,
N.

On Thursday, November 20, 2014 8:15:52 PM UTC+2, Brian Coca wrote:
>
> this 2nd output shows ansible_facts not returning anything, unlike 
> your previous output. 
>
> but ran a test with my own system copying and pasting your last 
> playbook and I get this: 
>
> PLAY [localhost] 
> ************************************************************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [localhost] 
>
> TASK: [show inventory_hostname] 
> *********************************************** 
> ok: [localhost] => { 
>     "msg": "inventory_hostname is  localhost" 
> } 
>
> TASK: [show ansible_fqdn] 
> ***************************************************** 
> ok: [localhost] => { 
>     "msg": "ansible_fqdn is  workstation.briancoca.local" 
> } 
>
> TASK: [set ansible_fqdn fact] 
> ************************************************* 
> ok: [localhost] 
>
> TASK: [show ansible_fqdn] 
> ***************************************************** 
> ok: [localhost] => { 
>     "msg": "ansible_fqdn is  localhost" 
> } 
>
> PLAY RECAP 
> ******************************************************************** 
> localhost                  : ok=5    changed=0    unreachable=0   
>  failed=0 
>
> what version of ansible are you using? 
> -- 
> Brian Coca 
>

-- 
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/939aabc6-3aa6-4fff-b413-d4ceb900ec05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to