From 2c804df2989fdd6c0f532a4da807de3fa3a0d1b0 Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 31 May 2022 20:52:46 +0200 Subject: [PATCH] adapt for redat --- tasks/main.yml | 21 +++++++++++++++++---- tests/inventory | 1 + tests/test.yml | 4 ++++ vars/Archlinux.yml | 5 +++++ vars/RedHat.yml | 5 +++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 tests/inventory create mode 100644 tests/test.yml create mode 100644 vars/Archlinux.yml create mode 100644 vars/RedHat.yml diff --git a/tasks/main.yml b/tasks/main.yml index 8e982b9..5a32d21 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,22 @@ +- name: Include OS-specific variables. + include_vars: "{{ ansible_os_family }}.yml" + +- name: Add CentOS repository + block: + + - name: Add Docker repository. + get_url: + url: "https://download.docker.com/linux/centos/docker-ce.repo" + dest: '/etc/yum.repos.d/docker-ce.repo' + owner: root + group: root + mode: 0644 + when: ansible_os_family == "RedHat" + become: true + - name: Install Docker. package: - name: - - docker - - python-docker - - docker-compose + name: "{{ docker_package }}" state: present notify: restart docker become: true diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..748fdfa --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - docker diff --git a/vars/Archlinux.yml b/vars/Archlinux.yml new file mode 100644 index 0000000..26ec4de --- /dev/null +++ b/vars/Archlinux.yml @@ -0,0 +1,5 @@ +--- +docker_package: + - docker + - python-docker + - docker-compose diff --git a/vars/RedHat.yml b/vars/RedHat.yml new file mode 100644 index 0000000..acac966 --- /dev/null +++ b/vars/RedHat.yml @@ -0,0 +1,5 @@ +--- +docker_package: + - docker-ce + - python3-docker + - docker-compose-plugin