Skip to content
This repository has been archived by the owner on Jun 25, 2023. It is now read-only.

Commit

Permalink
Properly handle custom unattended_origins_patterns variable
Browse files Browse the repository at this point in the history
Well, this is painful.
  • Loading branch information
jnv committed Sep 30, 2014
1 parent 32f72d9 commit 4daa442
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#Unattended-Upgrade::Origins-Pattern
# Automatically upgrade packages from these origin patterns
# e.g.: 'o=Debian,a=stable', 'o=Debian,a=stable-updates'
unattended_origins_patterns: []
#
# Left unset, distribution-specific defaults will be used through
# __unattended_origins_patterns variable only if this variable
# is not provided externally
# REFS https://github.com/ansible/ansible/issues/8121
#unattended_origins_patterns: []

#Unattended-Upgrade::Package-Blacklist
# List of packages to not update
Expand Down
12 changes: 9 additions & 3 deletions templates/unattended-upgrades.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// Unattended-Upgrade::Origins-Pattern controls which packages are
// upgraded.
Unattended-Upgrade::Origins-Pattern {
{% for origin in unattended_origins_patterns %}
"{{ origin }}";
{% endfor %}
{% if unattended_origins_patterns is defined %}
{% for origin in unattended_origins_patterns %}
"{{ origin }}";
{% endfor %}
{% else %}
{% for origin in __unattended_origins_patterns %}
"{{ origin }}";
{% endfor %}
{% endif %}
};

// List of packages to not update (regexp are supported)
Expand Down
2 changes: 1 addition & 1 deletion vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
unattended_origins_patterns:
__unattended_origins_patterns:
- 'origin=Debian,archive=${distro_codename},label=Debian-Security'
2 changes: 1 addition & 1 deletion vars/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
unattended_origins_patterns:
__unattended_origins_patterns:
- 'origin=Ubuntu,archive=${distro_codename}-security,label=Ubuntu'

0 comments on commit 4daa442

Please sign in to comment.