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