From aa8b89604d53dec9e5ec0698572e8bd4d105abea Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 12 May 2019 12:00:32 +0200 Subject: [PATCH] Add support for archlinux Signed-off-by: Knut Ahlers --- README.md | 1 + meta/main.yml | 2 ++ tasks/Archlinux.yml | 14 ++++++++++++++ tasks/Debian.yml | 5 +++++ tasks/Ubuntu.yml | 24 ++++++++++++++++++++++++ tasks/main.yml | 22 ++-------------------- 6 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 tasks/Archlinux.yml create mode 100644 tasks/Debian.yml create mode 100644 tasks/Ubuntu.yml diff --git a/README.md b/README.md index 14ecb39..c7e91ad 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This role installs latest docker-ce on a host, configures its startup parameters ## Requirements +- Archlinux - Debian >= 8 (jessie) - Ubuntu >= 16.04 (xenial) diff --git a/meta/main.yml b/meta/main.yml index cb26b47..ff681bf 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -15,6 +15,8 @@ galaxy_info: versions: - jessie - stretch + - name: Archlinux + versions: [all] categories: #- cloud diff --git a/tasks/Archlinux.yml b/tasks/Archlinux.yml new file mode 100644 index 0000000..38ee74b --- /dev/null +++ b/tasks/Archlinux.yml @@ -0,0 +1,14 @@ +--- + +- name: Install docker + pacman: + name: docker + update_cache: true + +- name: Enable and start docker + systemd: + name: docker + enabled: true + state: started + +... diff --git a/tasks/Debian.yml b/tasks/Debian.yml new file mode 100644 index 0000000..48cb971 --- /dev/null +++ b/tasks/Debian.yml @@ -0,0 +1,5 @@ +--- + +- include: Ubuntu.yml + +... diff --git a/tasks/Ubuntu.yml b/tasks/Ubuntu.yml new file mode 100644 index 0000000..191ec10 --- /dev/null +++ b/tasks/Ubuntu.yml @@ -0,0 +1,24 @@ +--- + +- name: Install apt-key + apt_key: + id: 0EBFCD88 + url: 'https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg' + keyring: /etc/apt/trusted.gpg.d/docker.gpg + +- name: Ensure https transport to be available + apt: + name: apt-transport-https + cache_valid_time: 86400 + +- name: Activate apt-repo + apt_repository: + repo: 'deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_channel }}' + state: present + +- name: Install docker + apt: + name: docker-ce + cache_valid_time: 86400 + +... diff --git a/tasks/main.yml b/tasks/main.yml index fa2b0d6..5d6527c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,25 +1,7 @@ --- -- name: Install apt-key - apt_key: - id: 0EBFCD88 - url: 'https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg' - keyring: /etc/apt/trusted.gpg.d/docker.gpg - -- name: Ensure https transport to be available - apt: - name: apt-transport-https - cache_valid_time: 86400 - -- name: Activate apt-repo - apt_repository: - repo: 'deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_channel }}' - state: present - -- name: Install docker - apt: - name: docker-ce - cache_valid_time: 86400 +- name: "Loading distribution specific instructions for {{ ansible_distribution }}" + include: "{{ ansible_distribution }}.yml" - set_fact: docker_global_ipv6: "{{ ansible_eth0.ipv6 | selectattr('scope', 'equalto', 'global') | first }}"