diff --git a/ansible/webserver-automation/README.md b/ansible/webserver-automation/README.md new file mode 100644 index 0000000..8263f48 --- /dev/null +++ b/ansible/webserver-automation/README.md @@ -0,0 +1,136 @@ +# ๐Ÿš€ Ansible Web Server Automation + +Simple, production-ready Ansible project for automated web server setup. + +## ๐Ÿ“‹ Features + +- โœ… Nginx web server installation +- โœ… Firewall configuration (UFW) +- โœ… Application deployment +- โœ… User management +- โœ… SSL/TLS support +- โœ… Automated configuration + +## ๐Ÿ—๏ธ Structure + +``` +ansible/webserver-automation/ +โ”œโ”€โ”€ ansible.cfg # Ansible config +โ”œโ”€โ”€ inventory/ # Server inventory +โ”‚ โ”œโ”€โ”€ production +โ”‚ โ””โ”€โ”€ development +โ”œโ”€โ”€ group_vars/ # Variables +โ”‚ โ”œโ”€โ”€ all.yml +โ”‚ โ””โ”€โ”€ webservers.yml +โ”œโ”€โ”€ playbooks/ # Playbooks +โ”‚ โ”œโ”€โ”€ site.yml # Main playbook +โ”‚ โ””โ”€โ”€ deploy.yml # Deployment +โ””โ”€โ”€ roles/ # Ansible roles + โ”œโ”€โ”€ common/ + โ”œโ”€โ”€ nginx/ + โ””โ”€โ”€ firewall/ +``` + +## ๐Ÿš€ Quick Start + +### Install Ansible +```bash +sudo apt install ansible -y +``` + +### Clone Project +```bash +git clone http://git.thedevops.dev/admin/k3s-gitops.git +cd k3s-gitops/ansible/webserver-automation +``` + +### Configure +Edit `inventory/production`: +```ini +[webservers] +web1 ansible_host=192.168.1.10 + +[all:vars] +ansible_user=ubuntu +``` + +### Run +```bash +# Test connection +ansible -i inventory/production all -m ping + +# Deploy +ansible-playbook -i inventory/production playbooks/site.yml +``` + +## ๐Ÿ“š Usage + +### Full Setup +```bash +ansible-playbook -i inventory/production playbooks/site.yml +``` + +### Deploy App +```bash +ansible-playbook -i inventory/production playbooks/deploy.yml +``` + +### Check Mode (Dry Run) +```bash +ansible-playbook -i inventory/production playbooks/site.yml --check +``` + +### Verbose +```bash +ansible-playbook -i inventory/production playbooks/site.yml -vv +``` + +## ๐Ÿ”ง Configuration + +Edit `group_vars/webservers.yml`: +```yaml +nginx_port: 80 +app_name: myapp +app_dir: /var/www/myapp +domain_name: example.com +``` + +## ๐Ÿ” Security + +### SSH Keys +```bash +ssh-keygen -t ed25519 +ssh-copy-id ubuntu@192.168.1.10 +``` + +### Ansible Vault +```bash +ansible-vault encrypt group_vars/production.yml +ansible-vault edit group_vars/production.yml +``` + +## ๐Ÿงช Testing + +```bash +# Syntax check +ansible-playbook playbooks/site.yml --syntax-check + +# List tasks +ansible-playbook -i inventory/production playbooks/site.yml --list-tasks +``` + +## ๐Ÿ“ฆ Requirements + +- Ansible >= 2.9 +- Python >= 3.6 +- Target: Ubuntu 20.04/22.04 +- SSH access + +## ๐Ÿ“„ License + +MIT + +--- + +**Status:** โœ… Ready to use! +**Version:** 1.0.0