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
- name : Update package management cache (APT)
apt :
update_cache : yes
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 :
- ansible_distribution in ["CentOS","RedHat","OracleLinux"]
2020-03-17 18:12:21 +08:00
- not is_fedora_coreos
2020-02-18 00:59:28 +08:00
2018-08-23 22:51:52 +08:00
- name : Install python-dnf for latest RedHat versions
command : dnf install -y python-dnf yum
register : dnf_task_result
2018-10-17 06:33:30 +08:00
until : dnf_task_result is succeeded
2018-08-23 22:51:52 +08:00
retries : 4
delay : "{{ retry_stagger | random + 3 }}"
when :
- ansible_distribution == "Fedora"
- ansible_distribution_major_version|int > 21
2019-10-17 20:04:38 +08:00
- ansible_distribution_major_version|int <= 29
2020-03-17 18:12:21 +08:00
- not is_fedora_coreos
2019-10-17 20:04:38 +08:00
changed_when : False
tags :
- bootstrap-os
- name : Install python3-dnf for latest RedHat versions
command : dnf install -y python3-dnf
register : dnf_task_result
until : dnf_task_result is succeeded
retries : 4
delay : "{{ retry_stagger | random + 3 }}"
when :
- ansible_distribution == "Fedora"
- ansible_distribution_major_version|int >= 30
2020-03-17 18:12:21 +08:00
- not is_fedora_coreos
2018-08-23 22:51:52 +08:00
changed_when : False
tags :
- bootstrap-os
- name : Install epel-release on RedHat/CentOS
yum :
name : epel-release
state : present
when :
- ansible_distribution in ["CentOS","RedHat"]
2020-03-17 18:12:21 +08:00
- not is_fedora_coreos
2018-08-23 22:51:52 +08:00
- epel_enabled|bool
tags :
- bootstrap-os
2018-11-08 06:04:11 +08:00
- name : Update common_required_pkgs with ipvsadm when kube_proxy_mode is ipvs
set_fact :
2019-07-09 20:41:59 +08:00
common_required_pkgs : "{{ common_required_pkgs|default([]) + ['ipvsadm', 'ipset'] }}"
2018-11-08 06:04:11 +08:00
when : kube_proxy_mode == 'ipvs'
2018-08-23 22:51:52 +08:00
- name : Install packages requirements
action :
module : "{{ ansible_pkg_mgr }}"
2019-02-01 06:57:22 +08:00
name : "{{ required_pkgs | default([]) | union(common_required_pkgs|default([])) }}"
2018-08-23 22:51:52 +08:00
state : latest
register : pkgs_task_result
2018-10-17 06:33:30 +08:00
until : pkgs_task_result is succeeded
2018-08-23 22:51:52 +08:00
retries : 4
delay : "{{ retry_stagger | random + 3 }}"
2020-03-18 05:31:27 +08:00
when : not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_fedora_coreos)
2018-08-23 22:51:52 +08:00
tags :
- bootstrap-os
2018-12-18 17:39:25 +08:00
- name : Install ipvsadm for ClearLinux
swupd :
name : ipvsadm
state : present
when :
- ansible_os_family in ["ClearLinux"]
- kube_proxy_mode == 'ipvs'