homeserver/.gitlab-ci.yml

66 lines
1.8 KiB
YAML
Raw Normal View History

2021-01-27 09:15:34 +01:00
stages:
2021-01-29 12:33:22 +01:00
- lint
2021-01-30 11:49:18 +01:00
- deploy-test
- deploy-prod
2021-01-27 09:15:34 +01:00
2021-01-29 12:45:33 +01:00
variables:
GIT_SUBMODULE_STRATEGY: recursive
2021-01-27 09:15:34 +01:00
ansible-lint:
2021-01-29 12:33:22 +01:00
image: willhallonline/ansible:2.9-ubuntu-20.04
stage: lint
before_script:
- chmod 0755 /builds/mg/ansible
2021-01-27 09:15:34 +01:00
script:
- ansible-lint .
2021-01-29 12:33:22 +01:00
interruptible: true
allow_failure: true
rules:
- if: $CI_MERGE_REQUEST_ID
markdown-lint:
stage: lint
image: pipelinecomponents/markdownlint:latest
script:
- mdl --style all --warnings .
interruptible: true
allow_failure: true
rules:
- if: $CI_MERGE_REQUEST_ID
2021-01-30 11:49:18 +01:00
ansible-deploy-test:
2021-01-29 12:33:22 +01:00
image: willhallonline/ansible:2.9-ubuntu-20.04
2021-01-30 11:49:18 +01:00
stage: deploy-test
2021-01-29 12:33:22 +01:00
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
2021-01-30 11:49:18 +01:00
- pip install 'pykeepass>3.2.0' --user
2021-01-29 12:33:22 +01:00
script:
2021-01-30 11:49:18 +01:00
- ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit test --vault-password-file $ansible_vault_pass
2021-01-29 12:33:22 +01:00
after_script:
- rm /builds/mg/ansible/id_rsa_ansible_user
rules:
- if: $CI_MERGE_REQUEST_ID
2021-01-30 11:49:18 +01:00
ansible-deploy-prod:
2021-01-29 12:33:22 +01:00
image: willhallonline/ansible:2.9-ubuntu-20.04
2021-01-30 11:49:18 +01:00
stage: deploy-prod
2021-01-29 12:33:22 +01:00
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
2021-01-30 11:49:18 +01:00
- pip install 'pykeepass>3.2.0' --user
2021-01-29 12:33:22 +01:00
script:
2021-01-30 11:49:18 +01:00
- ansible-playbook playbooks/base/0_master.yml playbooks/service/* -i inventory --limit production --vault-password-file $ansible_vault_pass
2021-01-29 12:33:22 +01:00
after_script:
- rm /builds/mg/ansible/id_rsa_ansible_user
rules:
- if: $CI_COMMIT_BRANCH == 'master'
# GitLab-CI-Vars
# $ansible_vault_pass - Type: File
# $id_rsa_ansible_user - Type: Variable