refactoring and cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2019-11-24 17:21:18 +01:00
parent 167ef0f6e3
commit 58470c2fb9
7 changed files with 45 additions and 31 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
# ---> Ansible
*.retry
filter/plugins/
plugins
library
# ---> Python

View File

@ -1,5 +1,6 @@
---
dockerengine_package: docker
dockerengine_packages:
- docker
# @var dockerengine_packages_extra:description: >
# The role requires epel repository and pip to work .You can use
@ -8,6 +9,11 @@ dockerengine_package: docker
# @var dockerengine_packages_extra:example: $ ["epel-release", "python2-pip"]
dockerengine_packages_extra: []
dockerengine_packages_python:
- name: docker-compose
dockerengine_service: docker
dockerengine_docker_group_enabled: False
dockerengine_secure_registries: []
dockerengine_insecure_registries: []

View File

@ -1,8 +1,8 @@
---
- name: Restart docker engine
systemd:
service:
state: restarted
name: "{{ dockerengine_package }}"
name: "{{ dockerengine_service }}"
daemon_reload: yes
enabled: yes
listen: __docker_restart

View File

@ -1,23 +1,5 @@
---
- block:
- name: Install docker engine
package:
name: "{{ dockerengine_package }}"
state: present
- name: Install dependencies
package:
name: "{{ item }}"
state: present
loop: "{{ dockerengine_packages_extra }}"
- name: Install python requirements
pip:
name: "{{ item.name }}"
executable: "{{ item.exec | default(omit) }}"
state: present
loop: "{{ __docker_python_requirements }}"
- name: Add docker group
group:
name: docker
@ -33,8 +15,8 @@
group: root
mode: 0644
loop:
- { src: 'etc/sysconfig/docker.j2', dest: '/etc/sysconfig/{{ dockerengine_package }}' }
- { src: 'etc/sysconfig/docker-storage-setup.j2', dest: '/etc/sysconfig/{{ dockerengine_package }}-storage-setup' }
- { src: 'etc/sysconfig/docker.j2', dest: '/etc/sysconfig/{{ dockerengine_service }}' }
- { src: 'etc/sysconfig/docker-storage-setup.j2', dest: '/etc/sysconfig/{{ dockerengine_service }}-storage-setup' }
- { src: 'etc/containers/registries.conf.j2', dest: '/etc/containers/registries.conf' }
loop_control:
label: "{{ item.dest }}"
@ -71,7 +53,7 @@
- name: Ensure docker engine is up and running
service:
name: "{{ dockerengine_package }}"
name: "{{ dockerengine_service }}"
enabled: True
state: started
become: True

30
tasks/install.yml Normal file
View File

@ -0,0 +1,30 @@
---
- block:
- name: Install dependencies
package:
name: "{{ item }}"
state: present
loop: "{{ dockerengine_packages_extra }}"
- name: Install packages
package:
name: "{{ dockerengine_packages }}"
state: present
- name: Install python packages
pip:
name: "{{ item.name }}"
executable: "{{ item.exec | default('/usr/bin/pip3') }}"
state: present
loop: "{{ dockerengine_packages_python }}"
loop_control:
label: "{{ item.name }}"
become: True
become_user: root
- name: Install ansible requirements
pip:
name: "{{ item }}"
state: present
loop:
- docker

View File

@ -1,2 +1,3 @@
---
- include_tasks: setup.yml
- include_tasks: install.yml
- include_tasks: config.yml

View File

@ -1,5 +0,0 @@
---
__docker_python_requirements:
- name: docker
- name: docker-compose
exec: /usr/bin/pip3