file.managed: | file.managed: | ||||
- mode: '0644' | - mode: '0644' | ||||
- user: root | - user: root | ||||
- group: root | |||||
- group: root | |||||
- contents: | - contents: | ||||
- "{{ 'Package: ' ~ p_package }}" | - "{{ 'Package: ' ~ p_package }}" | ||||
- "{{ 'Pin: ' ~ args.pin }}" | - "{{ 'Pin: ' ~ args.pin }}" | ||||
- "{{ 'Pin-Priority: ' ~ args.priority }}" | - "{{ 'Pin-Priority: ' ~ args.priority }}" | ||||
{% if 'explanation' in args %} | |||||
{% for explanation in args.explanation %} | |||||
- "{{ 'Explanation: ' ~ explanation }}" | |||||
{% endfor %} | |||||
{% endif %} | |||||
{% endfor %} | {% endfor %} |
/etc/apt/sources.list: | /etc/apt/sources.list: | ||||
file.managed: | file.managed: | ||||
{%- if remove_sources_list %} | |||||
- contents: '' | |||||
{%- else %} | |||||
- mode: '0644' | - mode: '0644' | ||||
- user: root | - user: root | ||||
- group: root | - group: root | ||||
{% if remove_sources_list %} | |||||
- contents: '' | |||||
- contents_newline: False | |||||
{% endif %} | {% endif %} | ||||
{{ sources_list_dir }}: | {{ sources_list_dir }}: | ||||
{%- for type in args.type|d(['binary']) %} | {%- for type in args.type|d(['binary']) %} | ||||
{%- set r_type = 'deb-src' if type == 'source' else 'deb' %} | {%- set r_type = 'deb-src' if type == 'source' else 'deb' %} | ||||
{{ repo }}{{ type }}: | |||||
{{ r_type }} {{ repo }}: | |||||
pkgrepo.managed: | pkgrepo.managed: | ||||
- name: {{ r_type }} {{ r_arch }} {{ r_url }} {{ r_distro }} {{ r_comps }} | - name: {{ r_type }} {{ r_arch }} {{ r_url }} {{ r_distro }} {{ r_comps }} | ||||
- file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list | - file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list | ||||
- keyserver: {{ r_keyserver }} | - keyserver: {{ r_keyserver }} | ||||
{% endif %} | {% endif %} | ||||
- clean_file: true | - clean_file: true | ||||
{%- endfor %} | {%- endfor %} | ||||
{% endfor %} | {% endfor %} | ||||
{% set unattended_upgrade = unattended.get('unattended_upgrade', '1') -%} | {% set unattended_upgrade = unattended.get('unattended_upgrade', '1') -%} | ||||
{% set auto_clean_interval = unattended.get('auto_clean_interval', '7') -%} | {% set auto_clean_interval = unattended.get('auto_clean_interval', '7') -%} | ||||
{% set verbose = unattended.get('verbose', '2') -%} | {% set verbose = unattended.get('verbose', '2') -%} | ||||
APT::Periodic::Enable "{{ enabled }}"; | |||||
APT::Periodic::Enable "{{ enabled }}"; | |||||
APT::Periodic::Update-Package-Lists "{{ update_package_lists }}"; | APT::Periodic::Update-Package-Lists "{{ update_package_lists }}"; | ||||
APT::Periodic::Download-Upgradeable-Packages "{{ download_upgradeable_packages }}"; | APT::Periodic::Download-Upgradeable-Packages "{{ download_upgradeable_packages }}"; | ||||
APT::Periodic::Unattended-Upgrade "{{ unattended_upgrade }}"; | APT::Periodic::Unattended-Upgrade "{{ unattended_upgrade }}"; |
Unattended-Upgrade::Allowed-Origins { | Unattended-Upgrade::Allowed-Origins { | ||||
{%- for pattern in allowed_origins %} | {%- for pattern in allowed_origins %} | ||||
"{{ pattern }}"; | "{{ pattern }}"; | ||||
{%- endfor %} | |||||
{%- endfor %} | |||||
}; | }; | ||||
Unattended-Upgrade::Package-Blacklist { | Unattended-Upgrade::Package-Blacklist { | ||||
{%- for package in package_blacklist %} | {%- for package in package_blacklist %} | ||||
"{{ package }}"; | "{{ package }}"; | ||||
{%- endfor %} | |||||
{%- endfor %} | |||||
}; | }; | ||||
Unattended-Upgrade::AutoFixInterruptedDpkg "{{ auto_fix_interrupted_dpkg }}"; | Unattended-Upgrade::AutoFixInterruptedDpkg "{{ auto_fix_interrupted_dpkg }}"; | ||||
Unattended-Upgrade::MinimalSteps "{{ minimal_steps }}"; | Unattended-Upgrade::MinimalSteps "{{ minimal_steps }}"; |
- pkgs: | - pkgs: | ||||
{% for pkg in apt_map.pkgs %} | {% for pkg in apt_map.pkgs %} | ||||
- {{ pkg }} | - {{ pkg }} | ||||
{% endfor %} | |||||
{% endfor %} | |||||
{{ apt_map.confd_dir }}/{{ apt_map.unattended_config }}: | {{ apt_map.confd_dir }}/{{ apt_map.unattended_config }}: | ||||
file.managed: | file.managed: |
unattended: | unattended: | ||||
allowed_origins: | allowed_origins: | ||||
- origin1 | - origin1 | ||||
- origin2 | |||||
package_blacklist: | |||||
- origin2 | |||||
package_blacklist: | |||||
- package1 | - package1 | ||||
- package2 | |||||
auto_fix_interrupted_dpkg: true | |||||
- package2 | |||||
auto_fix_interrupted_dpkg: true | |||||
minimal_steps: false | minimal_steps: false | ||||
install_on_shutdown: false | install_on_shutdown: false | ||||
mail: root | mail: root |