ci: adiciona terraform #5
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
# This is a basic workflow to help you get started with Actions | |
name: Ansible Docker Swarm | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: ['master'] | |
workflow_dispatch: | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run ansible-lint | |
uses: ansible-community/[email protected] | |
with: | |
args: "ansible" # my ansible files in a folder | |
run-playbook: | |
runs-on: ubuntu-latest | |
needs: [ validate ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies Including Ansible | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ansible/requirements.txt | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
name: id_rsa # optional | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
if_key_exists: replace # replace / ignore / fail; optional (defaults to fail) | |
- name: run playbook | |
run: | | |
ansible-playbook -i inventory ansible/hello-world.yaml |