generated from TIBHannover/application-setup-box-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
35 lines (32 loc) · 938 Bytes
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
stages:
- deploy
.deploy_job:
image: willhallonline/ansible:2.11-alpine-3.15
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | base64 -d | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ansible-playbook -v -i ${INVENTORY_FILE} prerequisites.yml
- ansible-playbook -v -i ${INVENTORY_FILE} ${PLAYBOOK} --extra-vars "gitlab_private_token=$CI_JOB_TOKEN"
Test Update:
variables:
INVENTORY_FILE: inventory_TEST.yml
PLAYBOOK: box/ansible/playbook.yml
extends: .deploy_job
only:
- master
when: manual
Prod Update:
variables:
INVENTORY_FILE: inventory_PROD.yml
PLAYBOOK: box/ansible/playbook.yml
extends: .deploy_job
only:
- master
when: manual