initial commit
This commit is contained in:
commit
9c7d801eea
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# ---> Ansible
|
||||||
|
*.retry
|
||||||
|
|
9
LICENSE
Normal file
9
LICENSE
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
54
README.md
Normal file
54
README.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# sit-lnx.docker-engine
|
||||||
|
|
||||||
|
Install docker engine. Currently only overlay2 as storage engine is supported.
|
||||||
|
|
||||||
|
**Supported OS**
|
||||||
|
* RHEL7
|
||||||
|
|
||||||
|
### Role Variables
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
dockerengine_package: docker
|
||||||
|
dockerengine_docker_group_enabled: False
|
||||||
|
|
||||||
|
dockerengine_secure_registries: []
|
||||||
|
dockerengine_insecure_registries: []
|
||||||
|
dockerengine_block_registries: []
|
||||||
|
|
||||||
|
# dockerengine_http_proxy: # defaults to not set
|
||||||
|
# dockerengine_https_proxy: # defaults to not set
|
||||||
|
# dockerengine_no_proxy: # defaults to not set
|
||||||
|
|
||||||
|
# All storage variables are mandatory. You have to set them correctly!
|
||||||
|
# dockerengine_storage_pvs: /dev/sdx # defaults to not set
|
||||||
|
dockerengine_storage_vg: vg_docker
|
||||||
|
dockerengine_storage_lv: lv_docker
|
||||||
|
dockerengine_storage_size: 100G
|
||||||
|
dockerengine_base_dir: /var/lib/docker
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
#### Playbook
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- hosts: docker-engine
|
||||||
|
become: true
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- sit-lnx.docker-engine
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
* you need the `wrap` custom filter from
|
||||||
|
|
||||||
|
### Maintainer
|
||||||
|
|
||||||
|
[Robert Kaussow](https://gitea.rknet.org/xoxys)
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
|
17
defaults/main.yml
Normal file
17
defaults/main.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
dockerengine_package: docker
|
||||||
|
dockerengine_docker_group_enabled: False
|
||||||
|
|
||||||
|
dockerengine_secure_registries: []
|
||||||
|
dockerengine_insecure_registries: []
|
||||||
|
dockerengine_block_registries: []
|
||||||
|
|
||||||
|
# dockerengine_http_proxy: # defaults to not set
|
||||||
|
# dockerengine_https_proxy: # defaults to not set
|
||||||
|
# dockerengine_no_proxy: # defaults to not set
|
||||||
|
|
||||||
|
# dockerengine_storage_pvs: /dev/sdx # defaults to not set
|
||||||
|
dockerengine_storage_vg: vg_docker
|
||||||
|
dockerengine_storage_lv: lv_docker
|
||||||
|
dockerengine_storage_size: 100G
|
||||||
|
dockerengine_base_dir: /var/lib/docker
|
10
handlers/main.yml
Normal file
10
handlers/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Restart docker engine
|
||||||
|
systemd:
|
||||||
|
state: restarted
|
||||||
|
name: "{{ dockerengine_package }}"
|
||||||
|
daemon_reload: yes
|
||||||
|
enabled: yes
|
||||||
|
listen: __docker_restart
|
||||||
|
become: True
|
||||||
|
become_user: root
|
13
meta/main.yml
Normal file
13
meta/main.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
author: Robert Kaussow
|
||||||
|
description: Install Docker Engine
|
||||||
|
license: MIT
|
||||||
|
min_ansible_version: 2.4
|
||||||
|
platforms:
|
||||||
|
- name: EL
|
||||||
|
versions:
|
||||||
|
- 7
|
||||||
|
galaxy_tags:
|
||||||
|
- docker
|
||||||
|
dependencies: []
|
34
tasks/install.yml
Normal file
34
tasks/install.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Install docker engine
|
||||||
|
package:
|
||||||
|
name: "{{ dockerengine_package }}"
|
||||||
|
state: installed
|
||||||
|
|
||||||
|
- name: Add docker group
|
||||||
|
group:
|
||||||
|
name: docker
|
||||||
|
state: present
|
||||||
|
notify: __docker_restart
|
||||||
|
when: dockerengine_docker_group_enabled
|
||||||
|
|
||||||
|
- name: Deploy config files to setup environment
|
||||||
|
template:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- { 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/containers/registries.conf.j2', dest: '/etc/containers/registries.conf' }
|
||||||
|
notify: __docker_restart
|
||||||
|
|
||||||
|
- name: Ensure docker engine is up and running
|
||||||
|
service:
|
||||||
|
name: "{{ dockerengine_package }}"
|
||||||
|
enabled: True
|
||||||
|
state: started
|
||||||
|
become: True
|
||||||
|
become_user: root
|
2
tasks/main.yml
Normal file
2
tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include_tasks: install.yml
|
27
templates/etc/containers/registries.conf.j2
Normal file
27
templates/etc/containers/registries.conf.j2
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
# This is a system-wide configuration file used to
|
||||||
|
# keep track of registries for various container backends.
|
||||||
|
# It adheres to TOML format and does not support recursive
|
||||||
|
# lists of registries.
|
||||||
|
|
||||||
|
# The default location for this configuration file is /etc/containers/registries.conf.
|
||||||
|
|
||||||
|
# The only valid categories are: 'registries.search', 'registries.insecure',
|
||||||
|
# and 'registries.block'.
|
||||||
|
|
||||||
|
[registries.search]
|
||||||
|
#registries = ['registry.access.redhat.com']
|
||||||
|
registries = [{{ dockerengine_secure_registries | wrap | join(',') }}]
|
||||||
|
|
||||||
|
# If you need to access insecure registries, add the registry's fully-qualified name.
|
||||||
|
# An insecure registry is one that does not have a valid SSL certificate or only does HTTP.
|
||||||
|
[registries.insecure]
|
||||||
|
registries = [{{ dockerengine_insecure_registries | wrap | join(',') }}]
|
||||||
|
|
||||||
|
|
||||||
|
# If you need to block pull access from a registry, uncomment the section below
|
||||||
|
# and add the registries fully-qualified name.
|
||||||
|
#
|
||||||
|
# Docker only
|
||||||
|
[registries.block]
|
||||||
|
registries = [{{ dockerengine_block_registries | wrap | join(',') }}]
|
7
templates/etc/sysconfig/docker-storage-setup.j2
Normal file
7
templates/etc/sysconfig/docker-storage-setup.j2
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
STORAGE_DRIVER=overlay2
|
||||||
|
DEVS={{ dockerengine_storage_pvs }}
|
||||||
|
CONTAINER_ROOT_LV_NAME={{ dockerengine_storage_lv }}
|
||||||
|
CONTAINER_ROOT_LV_SIZE={{ dockerengine_storage_size }}
|
||||||
|
CONTAINER_ROOT_LV_MOUNT_PATH={{ dockerengine_base_dir }}
|
||||||
|
VG={{ dockerengine_storage_vg }}
|
43
templates/etc/sysconfig/docker.j2
Normal file
43
templates/etc/sysconfig/docker.j2
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
## {{ ansible_managed }}
|
||||||
|
# /etc/sysconfig/docker
|
||||||
|
|
||||||
|
# Modify these options if you want to change the way the docker daemon runs
|
||||||
|
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
|
||||||
|
if [ -z "${DOCKER_CERT_PATH}" ]; then
|
||||||
|
DOCKER_CERT_PATH=/etc/docker
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Do not add registries in this file anymore. Use /etc/containers/registries.conf
|
||||||
|
# from the atomic-registries package.
|
||||||
|
#
|
||||||
|
|
||||||
|
# On an SELinux system, if you remove the --selinux-enabled option, you
|
||||||
|
# also need to turn on the docker_transition_unconfined boolean.
|
||||||
|
# setsebool -P docker_transition_unconfined 1
|
||||||
|
|
||||||
|
# Location used for temporary files, such as those created by
|
||||||
|
# docker load and build operations. Default is /var/lib/docker/tmp
|
||||||
|
# Can be overriden by setting the following environment variable.
|
||||||
|
# DOCKER_TMPDIR=/var/tmp
|
||||||
|
|
||||||
|
# Controls the /etc/cron.daily/docker-logrotate cron job status.
|
||||||
|
# To disable, uncomment the line below.
|
||||||
|
# LOGROTATE=false
|
||||||
|
|
||||||
|
# docker-latest daemon can be used by starting the docker-latest unitfile.
|
||||||
|
# To use docker-latest client, uncomment below lines
|
||||||
|
#DOCKERBINARY=/usr/bin/docker-latest
|
||||||
|
#DOCKERDBINARY=/usr/bin/dockerd-latest
|
||||||
|
#DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest
|
||||||
|
#DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest
|
||||||
|
|
||||||
|
# Proxy settings
|
||||||
|
{% if dockerengine_http_proxy is defined %}
|
||||||
|
HTTP_PROXY={{ dockerengine_http_proxy }}
|
||||||
|
{% endif %}
|
||||||
|
{% if dockerengine_https_proxy is defined %}
|
||||||
|
HTTPS_PROXY={{ dockerengine_https_proxy }}
|
||||||
|
{% endif %}
|
||||||
|
{% if dockerengine_no_proxy is defined %}
|
||||||
|
NO_PROXY={{ dockerengine_no_proxy|join(',') }}"
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user