refactoring #1

Merged
xoxys merged 5 commits from refactoring into master 2020-06-22 21:28:20 +00:00
6 changed files with 45 additions and 22 deletions

View File

@ -8,9 +8,6 @@ dockerengine_packages:
# @end
dockerengine_packages_extra: []
dockerengine_packages_python:
- name: docker-compose
dockerengine_service: docker
dockerengine_docker_group_enabled: False
@ -39,3 +36,20 @@ dockerengine_usernamespace_enabled: False
dockerengine_nsremap_user: dockremap
dockerengine_nsremap_range_start: 231072
dockerengine_nsremap_range_length: 65536
# @var dockerengine_networks:description: List of additional docker networks to create.
# @var dockerengine_networks:example: >
# dockerengine_networks:
# - name: my_network
# driver: bridge
# enable_ipv6: True
# ipam_config:
# - subnet: fdd1:ac8c:0557:7ce1::/64
# force: False
# state: present
# @end
dockerengine_networks: []
# @var dockerengine_networks:description: >
# List of extra docker networks to create. For configuration detials see `docker_networks`.
# @end
dockerengine_networks_extra: []

View File

@ -1,6 +1,10 @@
---
- name: Converge
hosts: all
vars:
dockerengine_packages_extra:
- epel-release
- python-pip
roles:
- role: xoxys.python3
- role: xoxys.docker_engine

View File

@ -1,5 +0,0 @@
---
- src: https://gitea.rknet.org/ansible/xoxys.python3.git
name: xoxys.python3
scm: git
version: master

View File

@ -56,5 +56,18 @@
name: "{{ dockerengine_service }}"
enabled: True
state: started
- name: Create docker networks
docker_network:
name: "{{ item.name }}"
driver: "{{ item.driver | default('bridge') }}"
enable_ipv6: "{{ item.enable_ipv6 | default(False) }}"
ipam_config: "{{ item.ipam_config | default(omit) }}"
force: "{{ item.force | default(omit) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ dockerengine_networks + dockerengine_networks_extra }}"
loop_control:
label: "{{ item.name }}"
notify: __docker_restart
become: True
become_user: root

View File

@ -6,19 +6,15 @@
state: present
loop: "{{ dockerengine_packages_extra }}"
- name: Install python dependencies
pip:
name: "{{ item }}"
loop: "{{ __docker_ansible_deps }}"
- name: Install packages
package:
name: "{{ item }}"
state: present
loop: "{{ dockerengine_packages + __docker_ansible_deps }}"
- 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 }}"
loop: "{{ dockerengine_packages }}"
become: True
become_user: root

View File

@ -1,3 +1,4 @@
---
__docker_ansible_deps:
- python-docker-py
- docker-compose~=1.24.0
- docker