Add Ansible integration for device management and deployment automation
- Added ansible/ directory with playbooks for: * deploy.yml: Update applications on devices from git * commands.yml: Execute arbitrary commands on devices * system_update.yml: OS updates and health checks * inventory.ini: Device and group configuration * README.md: Comprehensive Ansible guide * requirements.txt: Installation instructions - Added ansible_integration.py: Python module wrapping Ansible operations - Added utils_ansible.py: Updated utilities using Ansible instead of HTTP commands Key benefits: - Idempotent operations with error recovery - Comprehensive logging and backup - Multi-device orchestration - Better reliability and control - Replaces unreliable direct HTTP command execution
This commit is contained in:
64
ansible/requirements.txt
Normal file
64
ansible/requirements.txt
Normal file
@@ -0,0 +1,64 @@
|
||||
# Requirements for Server_Monitorizare Ansible Integration
|
||||
|
||||
## System Requirements
|
||||
- Ubuntu/Debian Linux
|
||||
- Python 3.7+
|
||||
- SSH access to target devices
|
||||
|
||||
## Python Packages
|
||||
# Flask and server dependencies
|
||||
Flask==2.3.0
|
||||
Werkzeug==2.3.0
|
||||
requests==2.31.0
|
||||
|
||||
# Ansible automation
|
||||
ansible>=2.10.0,<3.0.0
|
||||
ansible-core>=2.12.0
|
||||
|
||||
# Additional utilities
|
||||
python-dotenv==1.0.0
|
||||
pyyaml==6.0
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Install System Dependencies
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip python3-dev
|
||||
sudo apt-get install -y openssh-client openssh-server
|
||||
```
|
||||
|
||||
### 2. Install Python Packages
|
||||
```bash
|
||||
cd /srv/Server_Monitorizare
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
### 3. Install Ansible
|
||||
```bash
|
||||
pip3 install ansible>=2.10.0
|
||||
# or
|
||||
sudo apt-get install -y ansible
|
||||
```
|
||||
|
||||
### 4. Verify Installation
|
||||
```bash
|
||||
ansible --version
|
||||
ansible-playbook --version
|
||||
python3 -c "import ansible; print(ansible.__version__)"
|
||||
```
|
||||
|
||||
## Optional: For SSH Key Authentication
|
||||
```bash
|
||||
sudo apt-get install -y openssh-client
|
||||
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
|
||||
```
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# Test Ansible installation
|
||||
ansible localhost -m debug -a msg="Ansible works!"
|
||||
|
||||
# Test against devices
|
||||
ansible all -i ansible/inventory.ini -m ping
|
||||
```
|
||||
Reference in New Issue
Block a user