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

@ -3,14 +3,11 @@ dockerengine_packages:
- docker - docker
# @var dockerengine_packages_extra:description: > # @var dockerengine_packages_extra:description: >
# The role requires epel repository and pip to work .You can use # The role requires epel repository and pip to work. You can use
# `dockerengine_packages_extra` to install these dependencys. # `dockerengine_packages_extra` to install these dependencys.
# @end # @end
dockerengine_packages_extra: [] dockerengine_packages_extra: []
dockerengine_packages_python:
- name: docker-compose
dockerengine_service: docker dockerengine_service: docker
dockerengine_docker_group_enabled: False dockerengine_docker_group_enabled: False
@ -39,3 +36,20 @@ dockerengine_usernamespace_enabled: False
dockerengine_nsremap_user: dockremap dockerengine_nsremap_user: dockremap
dockerengine_nsremap_range_start: 231072 dockerengine_nsremap_range_start: 231072
dockerengine_nsremap_range_length: 65536 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 - name: Converge
hosts: all hosts: all
vars:
dockerengine_packages_extra:
- epel-release
- python-pip
roles: roles:
- role: xoxys.python3
- role: xoxys.docker_engine - 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 }}" name: "{{ dockerengine_service }}"
enabled: True enabled: True
state: started 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: True
become_user: root become_user: root

View File

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

View File

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