2018-09-06 14:26:57 +00:00
|
|
|
---
|
2018-08-23 14:51:52 +00:00
|
|
|
- name: Update package management cache (YUM)
|
|
|
|
yum:
|
|
|
|
update_cache: yes
|
|
|
|
name: '*'
|
|
|
|
register: yum_task_result
|
2018-10-16 22:33:30 +00:00
|
|
|
until: yum_task_result is succeeded
|
2018-08-23 14:51:52 +00:00
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
when:
|
|
|
|
- ansible_pkg_mgr == 'yum'
|
|
|
|
- ansible_distribution != 'RedHat'
|
|
|
|
- not is_atomic
|
|
|
|
|
|
|
|
- name: Expire management cache (YUM) for Updation - Redhat
|
|
|
|
shell: yum clean expire-cache
|
|
|
|
register: expire_cache_output
|
2018-10-16 22:33:30 +00:00
|
|
|
until: expire_cache_output is succeeded
|
2018-08-23 14:51:52 +00:00
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
when:
|
|
|
|
- ansible_pkg_mgr == 'yum'
|
|
|
|
- ansible_distribution == 'RedHat'
|
|
|
|
- not is_atomic
|
|
|
|
tags: bootstrap-os
|
|
|
|
|
|
|
|
- name: Update package management cache (YUM) - Redhat
|
|
|
|
shell: yum makecache
|
|
|
|
register: make_cache_output
|
2018-10-16 22:33:30 +00:00
|
|
|
until: make_cache_output is succeeded
|
2018-08-23 14:51:52 +00:00
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
when:
|
|
|
|
- ansible_pkg_mgr == 'yum'
|
|
|
|
- ansible_distribution == 'RedHat'
|
|
|
|
- expire_cache_output.rc == 0
|
|
|
|
- not is_atomic
|
|
|
|
tags: bootstrap-os
|
|
|
|
|
|
|
|
- name: Update package management cache (zypper) - SUSE
|
|
|
|
shell: zypper -n --gpg-auto-import-keys ref
|
|
|
|
register: make_cache_output
|
2018-10-16 22:33:30 +00:00
|
|
|
until: make_cache_output is succeeded
|
2018-08-23 14:51:52 +00: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
|
|
|
|
|
|
|
|
- name: Install python-dnf for latest RedHat versions
|
|
|
|
command: dnf install -y python-dnf yum
|
|
|
|
register: dnf_task_result
|
2018-10-16 22:33:30 +00:00
|
|
|
until: dnf_task_result is succeeded
|
2018-08-23 14:51:52 +00:00
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Fedora"
|
|
|
|
- ansible_distribution_major_version|int > 21
|
|
|
|
- not is_atomic
|
|
|
|
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"]
|
|
|
|
- not is_atomic
|
|
|
|
- epel_enabled|bool
|
|
|
|
tags:
|
|
|
|
- bootstrap-os
|
|
|
|
|
|
|
|
- name: Install packages requirements
|
|
|
|
action:
|
|
|
|
module: "{{ ansible_pkg_mgr }}"
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: latest
|
|
|
|
register: pkgs_task_result
|
2018-10-16 22:33:30 +00:00
|
|
|
until: pkgs_task_result is succeeded
|
2018-08-23 14:51:52 +00:00
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
|
|
|
|
when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] or is_atomic)
|
|
|
|
tags:
|
|
|
|
- bootstrap-os
|