From 7fc0fdce9bce3a110ac1e55cc457106f404ff4ad Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 5 Jun 2023 22:15:30 +0200 Subject: [PATCH] feat: add option to add custom unit override options --- .drone.jsonnet | 6 +++--- .drone.yml | 8 ++++---- defaults/main.yml | 5 +++-- molecule/{centos7 => rocky9}/converge.yml | 4 ++-- molecule/{centos7 => rocky9}/create.yml | 0 molecule/{centos7 => rocky9}/destroy.yml | 0 molecule/{centos7 => rocky9}/molecule.yml | 0 molecule/{centos7 => rocky9}/prepare.yml | 0 molecule/{centos7 => rocky9}/tests/test_default.py | 0 tasks/install.yml | 2 +- templates/etc/sysconfig/docker.j2 | 1 + .../etc/systemd/system/docker.service.d/override.conf.j2 | 7 +++++++ 12 files changed, 21 insertions(+), 12 deletions(-) rename molecule/{centos7 => rocky9}/converge.yml (74%) rename molecule/{centos7 => rocky9}/create.yml (100%) rename molecule/{centos7 => rocky9}/destroy.yml (100%) rename molecule/{centos7 => rocky9}/molecule.yml (100%) rename molecule/{centos7 => rocky9}/prepare.yml (100%) rename molecule/{centos7 => rocky9}/tests/test_default.py (100%) diff --git a/.drone.jsonnet b/.drone.jsonnet index bf6e5ab..ba03bb6 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -41,7 +41,7 @@ local PipelineLinting = { }, }; -local PipelineDeployment(scenario='centos7') = { +local PipelineDeployment(scenario='rocky9') = { kind: 'pipeline', name: 'testing-' + scenario, platform: { @@ -115,7 +115,7 @@ local PipelineDocumentation = { ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], }, depends_on: [ - 'testing-centos7', + 'testing-rocky9', ], }; @@ -153,7 +153,7 @@ local PipelineNotification = { [ PipelineLinting, - PipelineDeployment(scenario='centos7'), + PipelineDeployment(scenario='rocky9'), PipelineDocumentation, PipelineNotification, ] diff --git a/.drone.yml b/.drone.yml index d8f0bef..778f1bb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,7 +36,7 @@ trigger: --- kind: pipeline -name: testing-centos7 +name: testing-rocky9 platform: os: linux @@ -53,7 +53,7 @@ steps: - name: ansible-molecule image: thegeeklab/molecule:4 commands: - - molecule test -s centos7 + - molecule test -s rocky9 environment: HCLOUD_TOKEN: from_secret: hcloud_token @@ -107,7 +107,7 @@ trigger: - refs/pull/** depends_on: - - testing-centos7 + - testing-rocky9 --- kind: pipeline @@ -147,6 +147,6 @@ depends_on: --- kind: signature -hmac: 07e123ae54fb79836d48b0fee57666759de62d8e85a94d9386179e636b2235e3 +hmac: 9937973aed8a030a7c7d74909473f0424bea63aad70049727a2925b10d00aac2 ... diff --git a/defaults/main.yml b/defaults/main.yml index 8a50301..84a1d77 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,11 +13,12 @@ dockerengine_packages: dockerengine_packages_extra: [] docker_ansible_deps: - - cryptography~=2.0 - - docker-compose~=1.24.0 + - cryptography + - docker-compose - docker dockerengine_service: docker +dockerengine_service_override_unit: [] dockerengine_docker_group_enabled: False diff --git a/molecule/centos7/converge.yml b/molecule/rocky9/converge.yml similarity index 74% rename from molecule/centos7/converge.yml rename to molecule/rocky9/converge.yml index 48c685e..eef6af8 100644 --- a/molecule/centos7/converge.yml +++ b/molecule/rocky9/converge.yml @@ -4,8 +4,8 @@ vars: dockerengine_packages_extra: - epel-release - - python-pip - - python-virtualenv + - python3-pip + - python3-virtualenv roles: - role: xoxys.docker_engine diff --git a/molecule/centos7/create.yml b/molecule/rocky9/create.yml similarity index 100% rename from molecule/centos7/create.yml rename to molecule/rocky9/create.yml diff --git a/molecule/centos7/destroy.yml b/molecule/rocky9/destroy.yml similarity index 100% rename from molecule/centos7/destroy.yml rename to molecule/rocky9/destroy.yml diff --git a/molecule/centos7/molecule.yml b/molecule/rocky9/molecule.yml similarity index 100% rename from molecule/centos7/molecule.yml rename to molecule/rocky9/molecule.yml diff --git a/molecule/centos7/prepare.yml b/molecule/rocky9/prepare.yml similarity index 100% rename from molecule/centos7/prepare.yml rename to molecule/rocky9/prepare.yml diff --git a/molecule/centos7/tests/test_default.py b/molecule/rocky9/tests/test_default.py similarity index 100% rename from molecule/centos7/tests/test_default.py rename to molecule/rocky9/tests/test_default.py diff --git a/tasks/install.yml b/tasks/install.yml index 0f96d0d..981974c 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -20,7 +20,7 @@ pip: name: "{{ item }}" virtualenv: /opt/python2/ansible-deps - loop: "{{ docker_ansible_deps }}" + loop: "{{ dockerengine_ansible_deps }}" - name: Add docker-compose wrapper template: diff --git a/templates/etc/sysconfig/docker.j2 b/templates/etc/sysconfig/docker.j2 index 49eb121..2c4d193 100644 --- a/templates/etc/sysconfig/docker.j2 +++ b/templates/etc/sysconfig/docker.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: True {{ ansible_managed | comment }} OPTIONS='{{'--userns-remap=' + dockerengine_nsremap_user + ':' + dockerengine_nsremap_user if dockerengine_usernamespace_enabled | bool else '' }}' diff --git a/templates/etc/systemd/system/docker.service.d/override.conf.j2 b/templates/etc/systemd/system/docker.service.d/override.conf.j2 index 0a37281..85ea03c 100644 --- a/templates/etc/systemd/system/docker.service.d/override.conf.j2 +++ b/templates/etc/systemd/system/docker.service.d/override.conf.j2 @@ -1,3 +1,10 @@ +#jinja2: lstrip_blocks: True +{{ ansible_managed | comment }} +{% if dockerengine_service_override_unit | default([]) | length > 0 %} +[Unit] +{% for item in dockerengine_service_override_unit %} +{{ item }} +{% endfor %} [Service] EnvironmentFile=-/etc/sysconfig/docker ExecStart=