]> git.arvados.org - arvados.git/blob - tools/ansible/roles/distro_apt/tasks/main.yml
22238: Switch to a handler for apt updates
[arvados.git] / tools / ansible / roles / distro_apt / tasks / main.yml
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 - name: Check distribution
6   ansible.builtin.fail:
7     msg: "Unsupported distribution: {{ ansible_distribution }}"
8   when: distro_apt[ansible_distribution] is undefined
9
10 - name: Set up distribution apt repository
11   become: yes
12   ansible.builtin.deb822_repository:
13     name: "{{ ansible_distribution|lower }}"
14     types: deb
15     uris: "{{ distro_apt[ansible_distribution].aws_mirror if ansible_system_vendor == 'Amazon EC2' else distro_apt[ansible_distribution].mirror }}"
16     suites:
17       - "{{ ansible_distribution_release }}"
18       - "{{ ansible_distribution_release }}-updates"
19     components: "{{ distro_apt[ansible_distribution].components }}"
20   notify:
21     - apt update
22
23 - name: Set up distribution's security apt repository
24   become: yes
25   ansible.builtin.deb822_repository:
26     name: "{{ ansible_distribution|lower }}-security"
27     types: deb
28     uris: "{{ distro_apt[ansible_distribution].aws_security if ansible_system_vendor == 'Amazon EC2' else distro_apt[ansible_distribution].security }}"
29     suites:
30       - "{{ ansible_distribution_release }}-security"
31     components: "{{ distro_apt[ansible_distribution].components }}"
32   notify:
33     - apt update
34
35 - name: Configure APT::Periodic tasks
36   become: yes
37   ansible.builtin.template:
38     src: 65arvados-ansible-unattended-upgrades.j2
39     dest: /etc/apt/apt.conf.d/65arvados-ansible-unattended-upgrades
40     owner: root
41     group: root
42     mode: 0644