jnv / ansible-role-unattended-upgrades

[DEPRECATED] Setup unattended-upgrades on Debian-based systems
https://github.com/jnv/ansible-role-unattended-upgrades/issues/98
GNU General Public License v2.0
272 stars 94 forks source link

Two way for variables #5

Closed Claud closed 10 years ago

Claud commented 10 years ago

Issue Type: Bug Report Ansible Version: ansible 1.7.2 Environment: Ubuntu 14.04

Summary:
/playbook.yml


---
- name: Create of user
hosts: 'all'
sudo: yes
roles:
  # Add main user with sudo access.
  - role: add_user
    add_user__user:
      name: 'ansible-runner'

/roles/add_user/vars/main.yml


---
_home_path: '/home/{{ add_user__user.name }}'

/group_vars/* or /host_vars/*


---
add_user__user:
  name: 'master'

/roles/add_user/task/main.yml


---
- include_vars: main.yml

- debug: msg='{{ _home_path }}'

If I run this task. I see this:

TASK: [add_user | debug msg='/home/ansible-runner'] *** ok: [192.168.142.3] => { "msg": "/home/ansible-runner" }

I think that's right.

But if I change task to this:

/roles/add_user/task/main.yml


---
- debug: msg='{{ _home_path }}'

TASK: [add_user | debug msg='/home/ansible-runner'] *** ok: [192.168.142.3] => { "msg": "/home/master" }

This is unpredictable. Why is the variable of the playbook has a low priority?

So it must be, or this is a bug?