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 GIT_SUBMODULE_STRATEGY: recursive
ansible-lint: ansible-lint:
image: willhallonline/ansible:2.9-ubuntu-20.04 image: quotengrote/gitlab-ci-ansible:latest
stage: lint stage: lint
before_script: before_script:
- chmod 0755 /builds/mg/ansible - chmod 0755 /builds/mg/ansible
@ -17,6 +17,8 @@ ansible-lint:
allow_failure: true allow_failure: true
rules: rules:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
tags:
- ansible
markdown-lint: markdown-lint:
stage: lint stage: lint
@ -27,38 +29,42 @@ markdown-lint:
allow_failure: true allow_failure: true
rules: rules:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
tags:
- ansible
ansible-deploy-test: ansible-deploy-test:
image: willhallonline/ansible:2.9-ubuntu-20.04 image: quotengrote/gitlab-ci-ansible:latest
stage: deploy-test stage: deploy-test
interruptible: false interruptible: false
before_script: before_script:
- chmod 0755 /builds/mg/ansible - chmod 0755 /builds/mg/ansible
- echo "$id_rsa_ansible_user" > /builds/mg/ansible/id_rsa_ansible_user - echo "$id_rsa_ansible_user" > /builds/mg/ansible/id_rsa_ansible_user
- chmod 0400 /builds/mg/ansible/id_rsa_ansible_user - chmod 0400 /builds/mg/ansible/id_rsa_ansible_user
- pip install 'pykeepass>3.2.0' --user
script: script:
- ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit test --vault-password-file $ansible_vault_pass - ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit test --vault-password-file $ansible_vault_pass
after_script: after_script:
- rm /builds/mg/ansible/id_rsa_ansible_user - rm /builds/mg/ansible/id_rsa_ansible_user
rules: rules:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
tags:
- ansible
ansible-deploy-prod: ansible-deploy-prod:
image: willhallonline/ansible:2.9-ubuntu-20.04 image: quotengrote/gitlab-ci-ansible:latest
stage: deploy-prod stage: deploy-prod
interruptible: false interruptible: false
before_script: before_script:
- chmod 0755 /builds/mg/ansible - chmod 0755 /builds/mg/ansible
- echo "$id_rsa_ansible_user" > /builds/mg/ansible/id_rsa_ansible_user - echo "$id_rsa_ansible_user" > /builds/mg/ansible/id_rsa_ansible_user
- chmod 0400 /builds/mg/ansible/id_rsa_ansible_user - chmod 0400 /builds/mg/ansible/id_rsa_ansible_user
- pip install 'pykeepass>3.2.0' --user
script: script:
- ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit production --vault-password-file $ansible_vault_pass - ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit production --vault-password-file $ansible_vault_pass
after_script: after_script:
- rm /builds/mg/ansible/id_rsa_ansible_user - rm /builds/mg/ansible/id_rsa_ansible_user
rules: rules:
- if: $CI_COMMIT_BRANCH == 'master' - if: $CI_COMMIT_BRANCH == 'master'
tags:
- ansible
# GitLab-CI-Vars # GitLab-CI-Vars
# $ansible_vault_pass - Type: File # $ansible_vault_pass - Type: File

View file

@ -14,6 +14,7 @@
- mg - mg
- root - root
- ansible-user - ansible-user
- git
### ryandaniels.create_users ### ryandaniels.create_users
users: users:
- username: mg - username: mg
@ -44,3 +45,10 @@
/var/lib/docker/volumes/ocrmypdf-auto_scan_output/* /var/lib/docker/volumes/ocrmypdf-auto_scan_output/*
# https://github.com/restic/restic/issues/1005 # https://github.com/restic/restic/issues/1005
# https://forum.restic.net/t/exclude-syntax-confusion/1531/12 # 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 - root
- ansible-user - ansible-user
- git - git
- gitlab-runner
### geerlingguy.pip ### geerlingguy.pip
pip_package: python3-pip pip_package: python3-pip
pip_install_packages: pip_install_packages:
@ -15,7 +16,11 @@
gitlab_runner_runners: gitlab_runner_runners:
- name: "{{ ansible_hostname }}-docker" - name: "{{ ansible_hostname }}-docker"
executor: docker executor: docker
# docker_image: 'alpine' tags:
# docker_volumes: - ansible
# - "/var/run/docker.sock:/var/run/docker.sock" - 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: docker.grote.lan:
pve2.grote.lan: pve2.grote.lan:
gitlab.grote.lan: gitlab.grote.lan:
# gitlab-runner.grote.lan: gitlab-runner.grote.lan:
test: test:
hosts: hosts:
wireguard-test.grote.lan: wireguard-test.grote.lan:
@ -81,4 +81,4 @@ all:
lxc-test2.grote.lan: lxc-test2.grote.lan:
pve-test.grote.lan: pve-test.grote.lan:
gitlab-test.grote.lan: gitlab-test.grote.lan:
# gitlab-runner-test.grote.lan: gitlab-runner-test.grote.lan: