mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-22 19:02:10 +00:00
29 lines
632 B
YAML
29 lines
632 B
YAML
image: ansible/centos7-ansible
|
|
|
|
before_script:
|
|
# Run ssh-agent (inside the build environment)
|
|
- eval $(ssh-agent -s)
|
|
|
|
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent
|
|
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
|
|
|
#Create the SSH directory
|
|
- mkdir -p ~/.ssh
|
|
- chmod 700 ~/.ssh
|
|
|
|
#Verifying the SSH host keys
|
|
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
|
|
deploy_to_webserver:
|
|
stage: deploy
|
|
|
|
only:
|
|
- master
|
|
|
|
script:
|
|
- pwd
|
|
- echo -e "$ANSIBLE_HIFIVE_HOSTS" > /etc/ansible/hosts
|
|
- ansible-playbook .ansible-ci.yml
|
|
|
|
when: manual |