Create provisioning
This commit is contained in:
117
README.md
117
README.md
@@ -14,37 +14,74 @@ This project demonstrates automated Windows Server VM management including:
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Development Environment
|
||||
|
||||
```bash
|
||||
# Activate Ansible virtual environment
|
||||
source ~/.venv/ansible/bin/activate
|
||||
|
||||
# Install required collections
|
||||
ansible-galaxy collection install -r collections/requirements.yml
|
||||
|
||||
# Run VM provisioning
|
||||
ansible-playbook playbooks/provision-vm.yml -e vm_name=DEMO-WEB01
|
||||
# Verify Hyper-V connectivity
|
||||
ansible hyperv -m ansible.windows.win_ping
|
||||
```
|
||||
|
||||
### Provision a New VM
|
||||
|
||||
```bash
|
||||
# Using ansible-navigator (recommended)
|
||||
ansible-navigator run playbooks/provision-vm.yml \
|
||||
--execution-environment-image aap.toal.ca/ee-demo \
|
||||
--extra-vars "vm_name=WEB01 vm_ip_address=192.168.1.101"
|
||||
|
||||
# Or with ansible-playbook
|
||||
ansible-playbook playbooks/provision-vm.yml \
|
||||
-e vm_name=WEB01 \
|
||||
-e vm_ip_address=192.168.1.101 \
|
||||
-e vm_cpu_count=4 \
|
||||
-e vm_memory_gb=8
|
||||
```
|
||||
|
||||
**See [playbooks/README-provision.md](playbooks/README-provision.md) for detailed provisioning guide**
|
||||
|
||||
### Manage Existing VMs
|
||||
|
||||
```bash
|
||||
# Patch management
|
||||
ansible-playbook playbooks/patch-vms.yml --limit windows_servers
|
||||
|
||||
# Install IIS demo application
|
||||
ansible-playbook playbooks/install-iis.yml --limit web_servers
|
||||
|
||||
# Update CMDB
|
||||
ansible-playbook playbooks/sync-cmdb.yml
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
.
|
||||
├── ansible.cfg # Ansible configuration
|
||||
├── playbooks/ # Playbooks by use case
|
||||
│ ├── provision-vm.yml
|
||||
│ ├── patch-vms.yml
|
||||
│ ├── install-iis.yml
|
||||
│ └── sync-cmdb.yml
|
||||
├── roles/ # Custom roles
|
||||
├── group_vars/ # Group variables
|
||||
├── host_vars/ # Host-specific variables
|
||||
└── collections/ # Ansible collections
|
||||
└── requirements.yml
|
||||
├── ansible.cfg # Ansible config → uses toallab-inventory
|
||||
├── playbooks/ # Automation workflows
|
||||
│ ├── provision-vm.yml # VM provisioning with autounattend
|
||||
│ ├── create-autounattend-iso.yml # Helper for ISO creation
|
||||
│ ├── patch-vms.yml # Windows Update automation
|
||||
│ ├── install-iis.yml # IIS deployment demo
|
||||
│ ├── sync-cmdb.yml # ServiceNow integration
|
||||
│ └── README-provision.md # Detailed provisioning guide
|
||||
├── templates/ # Jinja2 templates
|
||||
│ └── autounattend.xml.j2 # Windows unattended install
|
||||
├── roles/ # Custom roles (future)
|
||||
└── collections/
|
||||
└── requirements.yml # Required collections
|
||||
```
|
||||
|
||||
**Inventory Location**: `/home/ptoal/Dev/inventories/toallab-inventory`
|
||||
- `group_vars/hyperv/` - Hyper-V host configuration
|
||||
- `group_vars/windows_servers/` - Windows Server defaults
|
||||
- `host_vars/hyperv1.lan.toal.ca/` - Hypervisor settings
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Ansible Automation Platform 2.x
|
||||
@@ -53,6 +90,58 @@ ansible-playbook playbooks/install-iis.yml --limit web_servers
|
||||
- ServiceNow instance (for CMDB integration)
|
||||
- Active Directory domain (for authentication)
|
||||
|
||||
## Key Features
|
||||
|
||||
### VM Provisioning
|
||||
- **Automated Installation**: Uses autounattend.xml for unattended Windows setup
|
||||
- **Flexible Configuration**: CPU, memory, disk size configurable via variables
|
||||
- **Network Setup**: Static IP or DHCP configuration
|
||||
- **WinRM Ready**: Automatically configured for Ansible management
|
||||
|
||||
### Idempotent Operations
|
||||
- All playbooks can be run multiple times safely
|
||||
- Check mode support for validation
|
||||
- Proper state management
|
||||
|
||||
### AAP Integration
|
||||
- Job template surveys for user-friendly VM creation
|
||||
- Webhook support for GitOps workflows
|
||||
- Credential management for secure operations
|
||||
|
||||
## Hypervisor
|
||||
|
||||
**Host**: hyperv1.lan.toal.ca (192.168.1.182)
|
||||
**Connection**: WinRM over HTTP (NTLM auth)
|
||||
**Default Storage**: D:\VMs
|
||||
**Default ISO Path**: D:\ISOs
|
||||
|
||||
## Documentation
|
||||
|
||||
See [CLAUDE.md](CLAUDE.md) for detailed architectural documentation and development guidance.
|
||||
- [CLAUDE.md](CLAUDE.md) - Architecture and development guidelines
|
||||
- [playbooks/README-provision.md](playbooks/README-provision.md) - VM provisioning guide
|
||||
- [templates/autounattend.xml.j2](templates/autounattend.xml.j2) - Windows unattended install template
|
||||
|
||||
## Common Tasks
|
||||
|
||||
### Provision a VM
|
||||
```bash
|
||||
ansible-playbook playbooks/provision-vm.yml -e vm_name=WEB01 -e vm_ip_address=192.168.1.101
|
||||
```
|
||||
|
||||
### Add VM to Inventory
|
||||
```bash
|
||||
# Edit /home/ptoal/Dev/inventories/toallab-inventory/static.yml
|
||||
# Add under web_servers/app_servers/db_servers:
|
||||
WEB01:
|
||||
ansible_host: 192.168.1.101
|
||||
```
|
||||
|
||||
### Configure VM
|
||||
```bash
|
||||
ansible-playbook playbooks/install-iis.yml --limit WEB01
|
||||
```
|
||||
|
||||
### Patch VMs
|
||||
```bash
|
||||
ansible-playbook playbooks/patch-vms.yml --limit windows_servers
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user