Blog_IMIE/.gitlab-ci.yml
2018-11-18 00:08:47 +01:00

35 lines
813 B
YAML

image: geerlingguy/docker-debian9-ansible
before_script:
- which ssh-agent || ( apt-get update -qq -y && apt-get install openssh-client -qq -y )
# 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:
- echo -e "$HIFIVE" > /etc/ansible/hosts
- cat /etc/ansible/hosts
- ansible-playbook ops/ansible/httpd-centos.yml
- find / -name ansible.cfg
- cat /root/ansible.cfg
when: manual