ansible-playbook-builderlisted
Install: claude install-skill WhiteMuush/Your-Claude-DevOps
# Ansible Playbook Builder
## Workflow
### 1. Analyser l'infrastructure cible
Recenser : systèmes d'exploitation (RHEL/Ubuntu/Debian), accès SSH (clé ou bastion), utilisateur de connexion (`ansible_user`), privilèges sudo.
**Critères de décision, inventaire statique vs dynamique :**
- < 20 hôtes stables → inventaire statique INI/YAML
- Cloud (AWS, Azure, GCP) ou infra éphémère → plugin dynamique (`amazon.aws.ec2`, `azure.azcollection.azure_rm`)
### 2. Structurer l'inventaire
```ini
# inventories/production/hosts.ini
[web]
web01.prod.example.com ansible_user=deploy
web02.prod.example.com ansible_user=deploy
[db]
db01.prod.example.com ansible_user=deploy
[all:vars]
ansible_ssh_private_key_file=~/.ssh/id_ed25519
```
```
inventories/
production/
hosts.ini
group_vars/
all.yml # variables communes
web.yml # variables groupe web
host_vars/
db01.prod.example.com.yml
staging/
hosts.ini
group_vars/
```
Tester la connectivité avant tout playbook :
```bash
ansible all -i inventories/production/hosts.ini -m ping
```
### 3. Concevoir les playbooks
Structure minimale production-ready :
```yaml
# site.yml
---
- name: Configure web servers
hosts: web
become: true
gather_facts: true
tags: [web]
pre_tasks:
- name: Ensure Python3 is present
ansible.builtin.raw: apt-get install -y python3
changed_when: false
roles:
- role: common
- role: nginx
vars:
nginx_port: 443
post_