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

`'__unattended_origins_patterns' is undefined` error #16

Closed Yannik closed 8 years ago

Yannik commented 8 years ago

Hi,

I am trying to use your play with the default settings (install security updates but nothing else) like this:

- hosts: all
  roles:
    - role: jnv.unattended-upgrades
      unattended_mail: "user@example.org"

However, I am getting this failure when running it:

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [127.0.0.1]

TASK [jnv.unattended-upgrades : install unattended-upgrades] *******************
ok: [127.0.0.1]

TASK [jnv.unattended-upgrades : install reboot dependencies] *******************
skipping: [127.0.0.1]

TASK [jnv.unattended-upgrades : create APT auto-upgrades configuration] ********
ok: [127.0.0.1]

TASK [jnv.unattended-upgrades : create unattended-upgrades configuration] ******
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: ERROR! '__unattended_origins_patterns' is undefined"}

PLAY RECAP *********************************************************************
127.0.0.1               : ok=3    changed=0    unreachable=0    failed=1

Information about the system I am running this on:

$ ansible --version
ansible 2.0.0.2
  config file = 
  configured module search path = Default w/o overrides
$ cat /etc/debian_version 
8.3
$ cat /etc/issue
Debian GNU/Linux 8 \n \l
$ cat /etc/ansible/roles/jnv.unattended-upgrades/meta/.galaxy_install_info 
{install_date: 'Wed Feb 17 10:14:56 2016', version: v1.1.1}

Any idea how to fix this?

Yannik commented 8 years ago

I found the issue: I was running the playbook using --tags unattended. The problem is, that the task adding the distribution-specific variables is missing the tag unattended: https://github.com/jnv/ansible-role-unattended-upgrades/blob/master/tasks/main.yml#L2