From 677be1b6b266b6b45aec9ca38382f87584340985 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 19 Jun 2024 12:25:03 +0200 Subject: [PATCH] Prepare ansible roles & plays Signed-off-by: Christian Berendt --- .ansible-lint | 12 ++++++++++++ .zuul.yaml | 7 +++++-- Containerfile | 3 ++- playbooks/cloudnative_pg.yml | 7 +++++++ roles/cloudnative_pg/meta/main.yml | 21 +++++++++++++++++++++ roles/cloudnative_pg/tasks/main.yml | 8 ++++++++ {playbooks => zuul-playbooks}/build.yml | 0 {playbooks => zuul-playbooks}/pre.yml | 0 8 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .ansible-lint create mode 100644 playbooks/cloudnative_pg.yml create mode 100644 roles/cloudnative_pg/meta/main.yml create mode 100644 roles/cloudnative_pg/tasks/main.yml rename {playbooks => zuul-playbooks}/build.yml (100%) rename {playbooks => zuul-playbooks}/pre.yml (100%) diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..08a6fb9 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,12 @@ +--- +exclude_paths: + - .github +use_default_rules: true +rulesdir: + - ./.ansible-lint-rules/ +skip_list: + - galaxy[no-changelog] +# DO NOT DELETE THE WARNLIST! It is required for our custom rules! +# If this isn't there our custom rules will only through a warning and wont generate a failure!: +warn_list: + - dummy diff --git a/.zuul.yaml b/.zuul.yaml index 99ffc51..19b6bff 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,8 +1,8 @@ --- - job: name: osism-kubernetes-build - pre-run: playbooks/pre.yml - run: playbooks/build.yml + pre-run: zuul-playbooks/pre.yml + run: zuul-playbooks/build.yml vars: docker_namespace: osism docker_registry: osism.harbor.regio.digital @@ -12,15 +12,18 @@ default-branch: main check: jobs: + - ansible-lint - hadolint - osism-kubernetes-build - yamllint gate: jobs: + - ansible-lint - hadolint - osism-kubernetes-build - yamllint periodic-daily: jobs: + - ansible-lint - hadolint - yamllint diff --git a/Containerfile b/Containerfile index 7660456..bac1fcb 100644 --- a/Containerfile +++ b/Containerfile @@ -10,6 +10,8 @@ ENV DEBIAN_FRONTEND=noninteractive USER root COPY --link charts /charts +COPY --link playbooks/* /ansible/ +COPY --link roles /ansible/roles SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -22,7 +24,6 @@ useradd -l -g dragon -G docker -u "$USER_ID" -m -d /ansible dragon # create required directories mkdir -p \ - /ansible \ /interface \ /share diff --git a/playbooks/cloudnative_pg.yml b/playbooks/cloudnative_pg.yml new file mode 100644 index 0000000..3f54484 --- /dev/null +++ b/playbooks/cloudnative_pg.yml @@ -0,0 +1,7 @@ +--- +- name: Apply role cloudnative_pg + hosts: localhost + connection: local + + roles: + - cloudnative_pg diff --git a/roles/cloudnative_pg/meta/main.yml b/roles/cloudnative_pg/meta/main.yml new file mode 100644 index 0000000..c705390 --- /dev/null +++ b/roles/cloudnative_pg/meta/main.yml @@ -0,0 +1,21 @@ +--- +galaxy_info: + author: Arvid Requate + description: Role osism.services.cloudnative_pg, an operator for PostgreSQL + license: Apache License 2.0 + min_ansible_version: 2.16.0 + platforms: + - name: Ubuntu + versions: + - jammy + - noble + - name: Debian + versions: + - bookworm + - name: EL + versions: + - "9" + galaxy_tags: + - helm + - kubernetes + - osism diff --git a/roles/cloudnative_pg/tasks/main.yml b/roles/cloudnative_pg/tasks/main.yml new file mode 100644 index 0000000..75d69b4 --- /dev/null +++ b/roles/cloudnative_pg/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- name: Deploy latest cloudnative-pg operator chart in namespace cnpg-system + kubernetes.core.helm: + release_name: cloudnative-pg + chart_ref: cnpg/cloudnative-pg + release_namespace: cnpg-system + create_namespace: true + wait: true diff --git a/playbooks/build.yml b/zuul-playbooks/build.yml similarity index 100% rename from playbooks/build.yml rename to zuul-playbooks/build.yml diff --git a/playbooks/pre.yml b/zuul-playbooks/pre.yml similarity index 100% rename from playbooks/pre.yml rename to zuul-playbooks/pre.yml