Initial commit
This commit is contained in:
88
README.md
Normal file
88
README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# ansible-role-template
|
||||
|
||||
> A reusable Ansible role template for deploying and managing
|
||||
> applications/services with security best practices.
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://www.ansible.com/)
|
||||
[](https://www.debian.org/)
|
||||
|
||||
## 📌 Key Features
|
||||
|
||||
✅ **Idempotent** - Safe to run multiple times
|
||||
✅ **Security Hardened** - Follows Ansible security best practices
|
||||
✅ **Modular** - Clear separation of concerns
|
||||
✅ **Documented** - Comprehensive README and variable documentation
|
||||
✅ **Tested** - Includes example playbook for validation
|
||||
|
||||
## 📂 Directory Structure
|
||||
|
||||
```text
|
||||
ansible-role-template/
|
||||
├── README.md # This file
|
||||
├── defaults/ # Default role variables
|
||||
│ └── main.yml
|
||||
├── handlers/ # Role handlers
|
||||
│ └── main.yml
|
||||
├── files/ # Static files to deploy
|
||||
├── meta/ # Role metadata
|
||||
│ └── main.yml
|
||||
├── tasks/ # Main role tasks
|
||||
│ ├── backup.yml # Backup-related tasks
|
||||
│ ├── main.yml # Core tasks
|
||||
│ └── monitoring.yml # Monitoring setup
|
||||
├── templates/ # Jinja2 templates
|
||||
└── vars/ # Non-overridable variables
|
||||
└── main.yml
|
||||
```
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Ansible 2.12+
|
||||
- Python 3.8+
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
## Default Variables (`defaults/main.yml`)
|
||||
|
||||
```yaml
|
||||
# Default values for role variables
|
||||
role_template_service_name: "default_service"
|
||||
role_template_service_port: 80
|
||||
role_template_backup_enabled: false
|
||||
role_template_service_backup_dir: "/var/backups/{{ role_template_service_name }}"
|
||||
role_template_monitoring_enabled: false
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
||||
### Example Playbook (`example-playbook.yml`)
|
||||
|
||||
```yaml
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- role: yourorg.ansible-role-template
|
||||
vars:
|
||||
role_template_service_name: "myapp"
|
||||
role_template_service_port: 8080
|
||||
```
|
||||
|
||||
### 3. Run the Playbook
|
||||
|
||||
```bash
|
||||
ansible-playbook -i inventory.ini example-playbook.yml
|
||||
```
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License
|
||||
See the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## TODO
|
||||
|
||||
☐ refactor
|
||||
☐ debug
|
||||
☐ docs
|
||||
Reference in New Issue
Block a user