Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ansible-deploy-bonus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: "Ansible - Deploy Go App"

on:
push:
branches: [main, master, lab06]
paths:
- 'ansible/vars/app_bonus.yml'
- 'ansible/playbooks/deploy_bonus.yml'
- 'ansible/roles/web_app/**'
- '.github/workflows/ansible-deploy-bonus.yml'
pull_request:
branches: [main, master]
paths:
- 'ansible/vars/app_bonus.yml'
- 'ansible/playbooks/deploy_bonus.yml'
- 'ansible/roles/web_app/**'

jobs:
lint:
name: "Ansible Lint - Bonus"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install ansible and ansible-lint
run: pip install ansible ansible-lint

- name: Run ansible-lint
run: |
cd ansible
ansible-lint playbooks/deploy_bonus.yml

deploy:
name: "Deploy Bonus App"
needs: lint
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

- name: Run deploy playbook
run: |
cd ansible
ansible-playbook playbooks/deploy_bonus.yml

- name: Verify bonus app health
run: |
sleep 5
curl -f http://localhost:8001/health
53 changes: 53 additions & 0 deletions .github/workflows/ansible-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: "Ansible - Deploy Python App"

on:
push:
branches: [main, master, lab06]
paths:
- 'ansible/vars/app_python.yml'
- 'ansible/playbooks/deploy_python.yml'
- 'ansible/roles/web_app/**'
- '.github/workflows/ansible-deploy.yml'
pull_request:
branches: [main, master]
paths:
- 'ansible/vars/app_python.yml'
- 'ansible/playbooks/deploy_python.yml'
- 'ansible/roles/web_app/**'

jobs:
lint:
name: "Ansible Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install ansible and ansible-lint
run: pip install ansible ansible-lint

- name: Run ansible-lint
run: |
cd ansible
ansible-lint playbooks/deploy_python.yml

deploy:
name: "Deploy Python App"
needs: lint
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

- name: Run deploy playbook
run: |
cd ansible
ansible-playbook playbooks/deploy_python.yml

- name: Verify python app health
run: |
sleep 5
curl -f http://localhost:8000/health
4 changes: 4 additions & 0 deletions ansible/.ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
profile: basic
skip_list:
- var-naming # web_app role uses shared variables intentionally for reusability
16 changes: 7 additions & 9 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[defaults]
inventory = inventory/hosts.ini
roles_path = roles
host_key_checking = False
remote_user = vagrant
inventory = inventory/hosts.ini
roles_path = roles
host_key_checking = False
retry_files_enabled = False
deprecation_warnings = False
stdout_callback = yaml
collections_paths = ~/.ansible/collections

[privilege_escalation]
become = True
become_method = sudo
become_user = root
[ssh_connection]
pipelining = True
Loading