Improved Docker support for SUSE/openSUSE. Notes about control host requirements

This commit is contained in:
Xan Manning 2019-12-09 13:53:42 +00:00
parent 26a3b2eef0
commit ec61e0b4ce
9 changed files with 60 additions and 29 deletions

View file

@ -9,24 +9,25 @@ env:
global:
- ROLE_NAME: k3s
matrix:
- MOLECULE_DISTRO: centos8
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: debian10
- MOLECULE_DISTRO: fedora29
- MOLECULE_DISTRO: fedora30
- MOLECULE_DISTRO: fedora31
- MOLECULE_DISTRO: amazonlinux2
- MOLECULE_DISTRO: geerlingguy/docker-centos8-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-centos7-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-debian10-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-ubuntu1804-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-fedora29-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-fedora30-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-fedora31-ansible:latest
- MOLECULE_DISTRO: geerlingguy/docker-amazonlinux2-ansible:latest
# Test installing docker
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: geerlingguy/docker-centos7-ansible:latest
MOLECULE_PLAYBOOK: playbook-docker.yml
# Test using alternate port and using wireguard as the flannel backend
- MOLECULE_DISTRO: debian10
- MOLECULE_DISTRO: geerlingguy/docker-fedora30-ansible:latest
MOLECULE_PLAYBOOK: playbook-docker-altport-wireguard.yml
# Test disabling all deployments
- MOLECULE_DISTRO: fedora31
- MOLECULE_DISTRO: geerlingguy/docker-fedora31-ansible:latest
MOLECULE_PLAYBOOK: playbook-no-deploy.yml
install:

View file

@ -7,6 +7,10 @@ Kubernetes") as either a standalone server or cluster.
## Requirements
The control host requires the following Python dependencies:
- `jmespath >= 0.9.0`
This role has been tested on Ansible 2.6.0+ against the following Linux Distributions:
- Amazon Linux 2

View file

@ -8,30 +8,30 @@ lint:
name: yamllint
platforms:
- name: node1
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
pre_build_image: ${MOLECULE_PREBUILT:-true}
networks:
- name: k3snet
- name: node2
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
pre_build_image: ${MOLECULE_PREBUILT:-true}
networks:
- name: k3snet
- name: node3
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
pre_build_image: ${MOLECULE_PREBUILT:-true}
networks:
- name: k3snet
provisioner:

View file

@ -1,10 +0,0 @@
---
- name: Ensure docker is installed using amazon-linux-extras
command: amazon-linux-extras install docker
args:
creates: /etc/docker
notify:
- restart docker
- meta: flush_handlers

View file

@ -0,0 +1,10 @@
---
- name: Ensure docker is installed using Zypper
zypper:
name: docker
state: present
notify:
- restart docker
- meta: flush_handlers

View file

@ -12,6 +12,13 @@
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
@ -22,3 +29,11 @@
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

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,10 @@
---
- name: Ensure docker is installed using Zypper
zypper:
name: docker
state: present
notify:
- restart docker
- meta: flush_handlers

View file

@ -11,10 +11,10 @@
when: k3s_use_docker
and ((k3s_control_workers)
or (not k3s_control_workers and not k3s_control_node))
and ansible_distribution | lower not in ['amazon']
and ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap']
- include_tasks: install-docker-{{ ansible_distribution | lower }}.yml
when: ansible_distribution | lower in ['amazon']
- include_tasks: install-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml
when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap']
- import_tasks: get-version.yml
when: k3s_release_version is not defined or not k3s_release_version