feat: add option to add custom unit override options (#5)
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #5
This commit is contained in:
Robert Kaussow 2023-06-05 22:55:25 +02:00
parent 0f881e669b
commit e9e83d2f8d
13 changed files with 46 additions and 25 deletions

View File

@ -41,7 +41,7 @@ local PipelineLinting = {
}, },
}; };
local PipelineDeployment(scenario='centos7') = { local PipelineDeployment(scenario='rocky9') = {
kind: 'pipeline', kind: 'pipeline',
name: 'testing-' + scenario, name: 'testing-' + scenario,
platform: { platform: {
@ -71,7 +71,7 @@ local PipelineDeployment(scenario='centos7') = {
'linting', 'linting',
], ],
trigger: { trigger: {
ref: ['refs/heads/main', 'refs/tags/**'], ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
}, },
}; };
@ -115,7 +115,7 @@ local PipelineDocumentation = {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
}, },
depends_on: [ depends_on: [
'testing-centos7', 'testing-rocky9',
], ],
}; };
@ -153,7 +153,7 @@ local PipelineNotification = {
[ [
PipelineLinting, PipelineLinting,
PipelineDeployment(scenario='centos7'), PipelineDeployment(scenario='rocky9'),
PipelineDocumentation, PipelineDocumentation,
PipelineNotification, PipelineNotification,
] ]

View File

@ -36,7 +36,7 @@ trigger:
--- ---
kind: pipeline kind: pipeline
name: testing-centos7 name: testing-rocky9
platform: platform:
os: linux os: linux
@ -53,7 +53,7 @@ steps:
- name: ansible-molecule - name: ansible-molecule
image: thegeeklab/molecule:4 image: thegeeklab/molecule:4
commands: commands:
- molecule test -s centos7 - molecule test -s rocky9
environment: environment:
HCLOUD_TOKEN: HCLOUD_TOKEN:
from_secret: hcloud_token from_secret: hcloud_token
@ -62,6 +62,7 @@ trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/**
depends_on: depends_on:
- linting - linting
@ -107,7 +108,7 @@ trigger:
- refs/pull/** - refs/pull/**
depends_on: depends_on:
- testing-centos7 - testing-rocky9
--- ---
kind: pipeline kind: pipeline
@ -147,6 +148,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: 07e123ae54fb79836d48b0fee57666759de62d8e85a94d9386179e636b2235e3 hmac: 5ecb808a24d61708adad225a6fd1ffde1b8de1a477f513e21c5e2b14c3790e0d
... ...

View File

@ -12,13 +12,23 @@ dockerengine_packages:
# @end # @end
dockerengine_packages_extra: [] dockerengine_packages_extra: []
docker_ansible_deps: dockerengine_ansible_deps:
- cryptography~=2.0 - cryptography
- docker-compose~=1.24.0 - docker-compose
- docker - docker
dockerengine_service: docker dockerengine_service: docker
# @var dockerengine_service_override_unit:description: >
# Multiline string of options to add to the `systemd` service override unit section.
# @end
# @var dockerengine_service_override_unit: $ "_unset_"
# @var dockerengine_service_override_unit:example: >
# dockerengine_service_override_unit: |
# After=time-sync.target
# Requires=time-sync.target
# @end
dockerengine_docker_group_enabled: False dockerengine_docker_group_enabled: False
# @var dockerengine_registries:description: List of docker registries to auto login # @var dockerengine_registries:description: List of docker registries to auto login

View File

@ -1,11 +0,0 @@
---
- name: Converge
hosts: all
vars:
dockerengine_packages_extra:
- epel-release
- python-pip
- python-virtualenv
roles:
- role: xoxys.docker_engine

View File

@ -0,0 +1,14 @@
---
- name: Converge
hosts: all
vars:
dockerengine_packages_extra:
- epel-release
- python3-pip
- python3-virtualenv
pre_tasks:
- name: Enable CodeReadyBuilder repository
command: dnf config-manager --set-enabled "crb"
changed_when: False
roles:
- role: xoxys.docker_engine

View File

@ -9,8 +9,8 @@ dependency:
driver: driver:
name: delegated name: delegated
platforms: platforms:
- name: centos7-docker-engine - name: rocky9-docker-engine
image: centos-7 image: rocky-9
server_type: cx11 server_type: cx11
lint: | lint: |
/usr/local/bin/flake8 /usr/local/bin/flake8

View File

@ -20,7 +20,7 @@
pip: pip:
name: "{{ item }}" name: "{{ item }}"
virtualenv: /opt/python2/ansible-deps virtualenv: /opt/python2/ansible-deps
loop: "{{ docker_ansible_deps }}" loop: "{{ dockerengine_ansible_deps }}"
- name: Add docker-compose wrapper - name: Add docker-compose wrapper
template: template:

View File

@ -1,3 +1,4 @@
#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
OPTIONS='{{'--userns-remap=' + dockerengine_nsremap_user + ':' + dockerengine_nsremap_user if dockerengine_usernamespace_enabled | bool else '' }}' OPTIONS='{{'--userns-remap=' + dockerengine_nsremap_user + ':' + dockerengine_nsremap_user if dockerengine_usernamespace_enabled | bool else '' }}'

View File

@ -1,3 +1,9 @@
#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }}
{% if dockerengine_service_override_unit is defined %}
[Unit]
{{ dockerengine_service_override_unit }}
{% endif %}
[Service] [Service]
EnvironmentFile=-/etc/sysconfig/docker EnvironmentFile=-/etc/sysconfig/docker
ExecStart= ExecStart=