Created
November 5, 2019 17:13
-
-
Save stefanotroia/430ce69f18bbd31ebf5061f92186f0fd to your computer and use it in GitHub Desktop.
Deploy in gitlab ci job with ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deploy: | |
image: | |
name: stefanotroia/ansible:latest | |
stage: deploy | |
script: | |
- printf "[ci_group]\n $SSH_SERVER ansible_ssh_user=$SSH_USER \n" > /etc/ansible/hosts | |
- cp $SSH_KEY key.pem && chmod 600 key.pem | |
- eval `keychain --eval` > /dev/null 2>&1 | |
- ssh-add key.pem | |
- ansible-playbook $CI_PROJECT_DIR/ansible-scripts/deploy.yml | |
only: | |
- development | |
- staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment