2018-09-06 22:26:57 +08:00
|
|
|
---
|
2020-07-28 16:39:08 +08:00
|
|
|
- name: Update package management cache (zypper) - SUSE
|
|
|
|
command: zypper -n --gpg-auto-import-keys ref
|
2018-08-23 22:51:52 +08:00
|
|
|
register: make_cache_output
|
2018-10-17 06:33:30 +08:00
|
|
|
until: make_cache_output is succeeded
|
2018-08-23 22:51:52 +08:00
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
when:
|
|
|
|
- ansible_pkg_mgr == 'zypper'
|
|
|
|
tags: bootstrap-os
|
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: Add debian 10 required repos
|
2023-08-10 15:57:27 +08:00
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
|
|
|
- ansible_distribution_version == "10"
|
|
|
|
tags:
|
|
|
|
- bootstrap-os
|
2023-07-26 22:36:22 +08:00
|
|
|
block:
|
2022-10-19 20:47:05 +08:00
|
|
|
- name: Add Debian Backports apt repo
|
|
|
|
apt_repository:
|
|
|
|
repo: "deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main"
|
|
|
|
state: present
|
|
|
|
filename: debian-backports
|
|
|
|
|
|
|
|
- name: Set libseccomp2 pin priority to apt_preferences on Debian buster
|
|
|
|
copy:
|
|
|
|
content: |
|
|
|
|
Package: libseccomp2
|
|
|
|
Pin: release a={{ ansible_distribution_release }}-backports
|
|
|
|
Pin-Priority: 1001
|
|
|
|
dest: "/etc/apt/preferences.d/libseccomp2"
|
|
|
|
owner: "root"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0644"
|
2022-10-19 20:47:05 +08:00
|
|
|
|
2018-08-23 22:51:52 +08:00
|
|
|
- name: Update package management cache (APT)
|
|
|
|
apt:
|
2024-08-28 13:30:56 +08:00
|
|
|
update_cache: true
|
2018-08-23 22:51:52 +08:00
|
|
|
cache_valid_time: 3600
|
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
tags:
|
|
|
|
- bootstrap-os
|
|
|
|
|
2020-02-18 00:59:28 +08:00
|
|
|
- name: Remove legacy docker repo file
|
|
|
|
file:
|
|
|
|
path: "{{ yum_repo_dir }}/docker.repo"
|
|
|
|
state: absent
|
|
|
|
when:
|
2021-04-23 14:50:03 +08:00
|
|
|
- ansible_os_family == "RedHat"
|
2020-03-17 18:12:21 +08:00
|
|
|
- not is_fedora_coreos
|
2020-02-18 00:59:28 +08:00
|
|
|
|
2021-04-23 14:50:03 +08:00
|
|
|
- name: Install epel-release on RHEL derivatives
|
2021-01-10 05:49:18 +08:00
|
|
|
package:
|
2018-08-23 22:51:52 +08:00
|
|
|
name: epel-release
|
|
|
|
state: present
|
|
|
|
when:
|
2021-04-23 14:50:03 +08:00
|
|
|
- ansible_os_family == "RedHat"
|
2020-03-17 18:12:21 +08:00
|
|
|
- not is_fedora_coreos
|
2023-07-05 11:36:54 +08:00
|
|
|
- epel_enabled | bool
|
2018-08-23 22:51:52 +08:00
|
|
|
tags:
|
|
|
|
- bootstrap-os
|
|
|
|
|
|
|
|
- name: Install packages requirements
|
2024-04-05 22:10:04 +08:00
|
|
|
vars:
|
|
|
|
# The json_query for selecting packages name is split for readability
|
|
|
|
# see files/pkgs-schema.json for the structure of `pkgs`
|
|
|
|
# and the matching semantics
|
2024-04-29 21:31:27 +08:00
|
|
|
full_query: "[? value | (enabled == null || enabled) && ( {{ filters_os }} ) && ( {{ filters_groups }} ) ].key"
|
2024-04-05 22:10:04 +08:00
|
|
|
filters_groups: "groups | @ == null || [? contains(`{{ group_names }}`, @)]"
|
|
|
|
filters_os: "os == null || (os | ( {{ filters_family }} ) || ( {{ filters_distro }} ))"
|
|
|
|
dquote: !unsafe '"'
|
|
|
|
# necessary to workaround Ansible escaping
|
|
|
|
filters_distro: "distributions.{{ dquote }}{{ ansible_distribution }}{{ dquote }} |
|
|
|
|
@ == `{}` ||
|
|
|
|
contains(not_null(major_versions, `[]`), '{{ ansible_distribution_major_version }}') ||
|
|
|
|
contains(not_null(versions, `[]`), '{{ ansible_distribution_version }}') ||
|
|
|
|
contains(not_null(releases, `[]`), '{{ ansible_distribution_release }}')"
|
|
|
|
filters_family: "families && contains(families, '{{ ansible_os_family }}')"
|
2021-01-10 05:49:18 +08:00
|
|
|
package:
|
2024-04-05 22:10:04 +08:00
|
|
|
name: "{{ pkgs | dict2items | to_json|from_json | community.general.json_query(full_query) }}"
|
2021-01-10 05:49:18 +08:00
|
|
|
state: present
|
2018-08-23 22:51:52 +08:00
|
|
|
register: pkgs_task_result
|
2018-10-17 06:33:30 +08:00
|
|
|
until: pkgs_task_result is succeeded
|
2020-11-23 15:47:35 +08:00
|
|
|
retries: "{{ pkg_install_retries }}"
|
2018-08-23 22:51:52 +08:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
2024-05-30 21:34:25 +08:00
|
|
|
when: not (ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] or is_fedora_coreos)
|
2018-08-23 22:51:52 +08:00
|
|
|
tags:
|
|
|
|
- bootstrap-os
|