From a72d61eebc205884435024c1a03836e2280e7df1 Mon Sep 17 00:00:00 2001 From: mg Date: Mon, 1 Feb 2021 08:20:01 +0100 Subject: [PATCH] Bugfix: gitlab-runner --- .gitlab-ci.yml | 16 +++++++++++----- group_vars/docker.yml | 8 ++++++++ group_vars/gitlabrunner.yml | 13 +++++++++---- inventory | 4 ++-- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71f25d2d..67f3e3e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ variables: GIT_SUBMODULE_STRATEGY: recursive ansible-lint: - image: willhallonline/ansible:2.9-ubuntu-20.04 + image: quotengrote/gitlab-ci-ansible:latest stage: lint before_script: - chmod 0755 /builds/mg/ansible @@ -17,6 +17,8 @@ ansible-lint: allow_failure: true rules: - if: $CI_MERGE_REQUEST_ID + tags: + - ansible markdown-lint: stage: lint @@ -27,38 +29,42 @@ markdown-lint: allow_failure: true rules: - if: $CI_MERGE_REQUEST_ID + tags: + - ansible ansible-deploy-test: - image: willhallonline/ansible:2.9-ubuntu-20.04 + image: quotengrote/gitlab-ci-ansible:latest stage: deploy-test interruptible: false before_script: - chmod 0755 /builds/mg/ansible - echo "$id_rsa_ansible_user" > /builds/mg/ansible/id_rsa_ansible_user - chmod 0400 /builds/mg/ansible/id_rsa_ansible_user - - pip install 'pykeepass>3.2.0' --user script: - ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit test --vault-password-file $ansible_vault_pass after_script: - rm /builds/mg/ansible/id_rsa_ansible_user rules: - if: $CI_MERGE_REQUEST_ID + tags: + - ansible ansible-deploy-prod: - image: willhallonline/ansible:2.9-ubuntu-20.04 + image: quotengrote/gitlab-ci-ansible:latest stage: deploy-prod interruptible: false before_script: - chmod 0755 /builds/mg/ansible - echo "$id_rsa_ansible_user" > /builds/mg/ansible/id_rsa_ansible_user - chmod 0400 /builds/mg/ansible/id_rsa_ansible_user - - pip install 'pykeepass>3.2.0' --user script: - ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit production --vault-password-file $ansible_vault_pass after_script: - rm /builds/mg/ansible/id_rsa_ansible_user rules: - if: $CI_COMMIT_BRANCH == 'master' + tags: + - ansible # GitLab-CI-Vars # $ansible_vault_pass - Type: File diff --git a/group_vars/docker.yml b/group_vars/docker.yml index 0032211b..5bc1ff57 100644 --- a/group_vars/docker.yml +++ b/group_vars/docker.yml @@ -14,6 +14,7 @@ - mg - root - ansible-user + - git ### ryandaniels.create_users users: - username: mg @@ -44,3 +45,10 @@ /var/lib/docker/volumes/ocrmypdf-auto_scan_output/* # https://github.com/restic/restic/issues/1005 # https://forum.restic.net/t/exclude-syntax-confusion/1531/12 + + ### riemers.gitlab-runner + gitlab_runner_coordinator_url: https://git.mgrote.net + gitlab_runner_registration_token: "{{ lookup('keepass', 'gitlab_runner_registration_token', 'password') }}" + gitlab_runner_runners: + - name: "{{ ansible_hostname }}-docker" + executor: docker diff --git a/group_vars/gitlabrunner.yml b/group_vars/gitlabrunner.yml index acdf1dfd..b3e7d4ec 100644 --- a/group_vars/gitlabrunner.yml +++ b/group_vars/gitlabrunner.yml @@ -5,6 +5,7 @@ - root - ansible-user - git + - gitlab-runner ### geerlingguy.pip pip_package: python3-pip pip_install_packages: @@ -15,7 +16,11 @@ gitlab_runner_runners: - name: "{{ ansible_hostname }}-docker" executor: docker -# docker_image: 'alpine' -# docker_volumes: -# - "/var/run/docker.sock:/var/run/docker.sock" - + tags: + - ansible + - hadolint + - name: "{{ ansible_hostname }}-shell" + executor: shell + tags: + - docker-build +# Wenn Änderungen nicht übernommen werden, Runner löschen und neu anlegen. diff --git a/inventory b/inventory index eb85486c..db0394df 100644 --- a/inventory +++ b/inventory @@ -67,7 +67,7 @@ all: docker.grote.lan: pve2.grote.lan: gitlab.grote.lan: -# gitlab-runner.grote.lan: + gitlab-runner.grote.lan: test: hosts: wireguard-test.grote.lan: @@ -81,4 +81,4 @@ all: lxc-test2.grote.lan: pve-test.grote.lan: gitlab-test.grote.lan: -# gitlab-runner-test.grote.lan: + gitlab-runner-test.grote.lan: