mirror of
https://github.com/PyratLabs/ansible-role-k3s
synced 2024-12-13 22:30:20 +01:00
49 lines
1.7 KiB
YAML
49 lines
1.7 KiB
YAML
---
|
|
|
|
- name: Ensure python-dnf is installed
|
|
package:
|
|
name: "{{ 'python-dnf' if ansible_python_version is version_compare('3.0.0', '<') else 'python3-dnf' }}"
|
|
state: present
|
|
register: ensure_python_dnf_installed
|
|
until: ensure_python_dnf_installed is succeeded
|
|
retries: 3
|
|
delay: 10
|
|
when: ansible_pkg_mgr == 'dnf'
|
|
|
|
- name: Ensure Docker prerequisites are installed
|
|
yum:
|
|
name:
|
|
- yum-utils
|
|
- device-mapper-persistent-data
|
|
- lvm2
|
|
state: present
|
|
register: ensure_docker_prerequisites_installed
|
|
until: ensure_docker_prerequisites_installed is succeeded
|
|
retries: 3
|
|
delay: 10
|
|
|
|
- name: Check to see if Docker repository is available for this distribution
|
|
uri:
|
|
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}"
|
|
register: k3s_redhat_repo_check
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Ensure Docker repository is installed and configured
|
|
yum_repository:
|
|
name: docker-ce
|
|
description: Docker CE Repository
|
|
baseurl: https://download.docker.com/linux/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/$basearch/stable
|
|
gpgkey: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
|
|
enabled: true
|
|
gpgcheck: true
|
|
state: present
|
|
when: ansible_distribution | lower not in ['amazon']
|
|
and k3s_redhat_repo_check.status == 200
|
|
|
|
- name: Ensure Docker repository is installed and configured from file
|
|
command: yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
|
|
args:
|
|
creates: /etc/yum.repos.d/docker-ce.repo
|
|
when: ansible_distribution | lower not in ['amazon']
|
|
and k3s_redhat_repo_check.status != 200
|