Update server #14
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
name: Update server | |
on: | |
workflow_run: | |
workflows: ["Docker Build (Docker Hub)"] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
# Git clone our ansible-scripts repository (private) | |
git-clone-ansible-scripts: | |
name: Run Ansible Playbook to update Ruby | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git Clone our Private Ansible Scripts | |
uses: actions/checkout@v3 | |
with: | |
repository: Ruby-Network/ansible-scripts | |
token: ${{ secrets.GH_TOKEN }} | |
ref: main | |
- name: Install Ansible | |
run: | | |
sudo apt update | |
sudo apt install ansible -y | |
- name: Send Webhook to Discord about updating Ruby | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"content":"Updating Ruby..."}' ${{ secrets.DISCORD_WEBHOOK }} | |
- name: SSH Known hosts ignore | |
run: | | |
mkdir -p ~/.ssh | |
touch ~/.ssh/known_hosts | |
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts | |
echo "StrictHostKeyChecking no" >> ~/.ssh/config | |
- name: Run Ansible Playbook | |
run: | | |
#we don't have ssh keys so we need to use the password | |
ansible-playbook -i ./hosts ./playbooks/ruby.yml --extra-vars "ansible_ssh_pass=${{ secrets.ANSIBLE_PASSWORD }}" | |
- name: Send Webhook to Discord about Ruby being updated | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"content":"Ruby has been updated! :tada:"}' ${{ secrets.DISCORD_WEBHOOK }} |