Skip to content

Deploy using ansible role instead of playbook #9

Deploy using ansible role instead of playbook

Deploy using ansible role instead of playbook #9

Workflow file for this run

name: Deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Clone Ansible
uses: actions/checkout@v2
with:
repository: Tina-otoge/infra
ref: master
- name: Install dependencies
run: |
pip install -U pip
pip install -r requirements.txt
- name: Save SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Run Ansible
env:
ANSIBLE_HOST_KEY_CHECKING: false
run: |
ansible ${{ secrets.DEPLOY_HOST }} -m include_role -a name=deploy \
-e "deploy_version=${{ github.sha }}" \
-e deploy_app=MechaDon2 \
-e deploy_service=mechadon \
-e "deploy_git=${{ github.repositoryUrl }}" \
-u ${{ secrets.DEPLOY_LOGIN_USER }} \
--become-user ${{ secrets.DEPLOY_USER }}