36 lines
1.9 KiB
Markdown
36 lines
1.9 KiB
Markdown
# 03 - Execution
|
|
|
|
Ensure you are operating within the `ansible/` directory inside the DevContainer.
|
|
|
|
## 1. Performance & Parallelism
|
|
This repository includes an `ansible.cfg` file configured for performance (`pipelining = True`) and high concurrency (`forks = 20`). If you are provisioning 10 independent servers concurrently in `standalone_mode`, Ansible will process them all simultaneously.
|
|
*(Warning: If your uplink bandwidth is limited, concurrent `apt dist-upgrade` tasks across 20 nodes may saturate the link. Lower the `forks` value if you experience APT timeouts).*
|
|
|
|
## 2. Test Connectivity
|
|
Verify SSH access to the nodes before triggering the pipeline.
|
|
|
|
**Authentication Flag (`-k`):** If you rely on root passwords, you must append `-k` (`--ask-pass`) to force Ansible to prompt you. If you have already deployed your SSH key to the nodes (e.g., via `ssh-copy-id`), omit the `-k` flag for seamless passwordless execution.
|
|
|
|
```bash
|
|
# With SSH Key deployed:
|
|
ansible all -i inventories/<customer_name>/hosts.yml -m ping -u root
|
|
|
|
# Without SSH Key (prompts for password):
|
|
ansible all -i inventories/<customer_name>/hosts.yml -m ping -u root -k
|
|
```
|
|
|
|
## 3. Execute the Playbook
|
|
Run the converged deployment playbook.
|
|
|
|
```bash
|
|
# With SSH Key deployed:
|
|
ansible-playbook -i inventories/<customer_name>/hosts.yml deploy.yml -u root
|
|
|
|
# Without SSH Key:
|
|
ansible-playbook -i inventories/<customer_name>/hosts.yml deploy.yml -u root -k
|
|
```
|
|
|
|
## Expected Behavior
|
|
* **Idempotency:** The playbook is declarative. If execution fails due to a transient network issue, re-running the exact command will bypass successful tasks and resume from the failure point.
|
|
* **State-Driven Reboots:** If APT installs core libraries or a new PVE kernel, it generates `/var/run/reboot-required`. Ansible detects this, initiates a graceful system reboot, drops the SSH connection, and continuously polls port 22 up to 10 minutes, seamlessly resuming execution once the servers are back online.
|