Bugfix: gitlab-runner

This commit is contained in:
Michael Grote 2021-02-01 08:20:01 +01:00
parent 4d4fa7fdfe
commit a72d61eebc
4 changed files with 30 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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: