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
5 changes: 3 additions & 2 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: python-ci

on:
workflow_dispatch:
push:
branches: ["lab03", "master"]
branches: ["lab03", "lab05", "master"]
paths:
- "app_python/**"
- ".github/workflows/python-ci.yml"
Expand Down Expand Up @@ -75,7 +76,7 @@ jobs:
docker-build-and-push:
runs-on: ubuntu-latest
needs: test-and-lint
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/lab03')
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/lab03' || github.ref == 'refs/heads/lab05')
permissions:
contents: read
steps:
Expand Down
18 changes: 15 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
test
.env
key.json
test
.env
key.json
# --- Ansible ---
*.retry
.vault_pass
ansible/inventory/*.pyc
ansible/inventory/__pycache__/
__pycache__/

# --- Vagrant ---
.vagrant/

# Do not commit real inventory with IPs if you don't want
# ansible/inventory/hosts.ini
21 changes: 21 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"
config.vm.hostname = "lab05"

# ВАЖНО: отключаем шаринг папки проекта в VM
# (часто ломается из-за кириллицы/пробелов в пути + нам не нужен репозиторий в VM)
config.vm.synced_folder ".", "/vagrant", disabled: true

# Пробрасываем порты на Windows-хост
# host_ip "0.0.0.0" нужно, чтобы WSL мог подключиться к проброшенному порту через IP Windows-хоста.
config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "0.0.0.0", id: "ssh", auto_correct: true
config.vm.network "forwarded_port", guest: 5000, host: 5000, host_ip: "0.0.0.0", id: "app", auto_correct: true

config.ssh.insert_key = true

config.vm.provider "virtualbox" do |vb|
vb.name = "lab05-ansible"
vb.memory = 2048
vb.cpus = 2
end
end
24 changes: 24 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Lab05 — Ansible

See:
- `labs/lab05.md` — assignment
- `ansible/docs/LAB05.md` — report template

## Quick start

```bash
cd ansible

# Install required collections
ansible-galaxy collection install -r requirements.yml

# Connectivity test
ansible all -m ping

# Provision the target VM (run twice to prove idempotency)
ansible-playbook playbooks/provision.yml
ansible-playbook playbooks/provision.yml

# Deploy the application (uses Ansible Vault)
ansible-playbook playbooks/deploy.yml --ask-vault-pass
```
14 changes: 14 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[defaults]
inventory = inventory/hosts.ini
roles_path = roles
host_key_checking = False
# For Vagrant boxes the default SSH user is usually "vagrant".
# You can still override this per-host in inventory/hosts.ini.
remote_user = vagrant
retry_files_enabled = False
interpreter_python = auto_silent

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