Update Flaskex Env #7
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: Ansible-Deploy | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
ANSIBLE_HOST_KEY_CHECKING: False | |
FLASKEX_REPO: "https://github.com/anfederico/flaskex.git" | |
FLASKEX_BRANCH: "master" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Python Packages | |
run: | | |
. /opt/pipx/venvs/ansible-core/bin/activate | |
/opt/pipx/venvs/ansible-core/bin/python -m pip install boto3 botocore | |
- name: Import SSH Private Key | |
run: | | |
echo "${{ secrets.ANSIBLE_SSH_KEY }}" > ansible-key | |
chmod 400 ansible-key | |
- name: Execute Ansible PLaybook | |
run: ansible-playbook -i aws_ec2.yml --private-key=ansible-key main.yml -u centos -b |