**Language / Язык:** [English](ansible.md) | [Русский](../ru/examples/ansible.md)

# Ansible

The playbook uses the `uri` module against the HTTPS gateway
(`https://localhost`), with Basic-auth session login followed by
`vmware-api-session-id`-header calls for the rest of the lifecycle.

```bash
cd examples/ansible
ansible-playbook -i inventory.ini vsphere_playbook.yml
```

[`vsphere_playbook.yml`](../../examples/ansible/vsphere_playbook.yml) covers:
session login, list VMs, create, power on, poll the CIS task
(`/api/cis/tasks/{task}`), write a file to the lab guest virtual filesystem,
power off, delete, and session logout.

Reseed the simulator (`make seed`) before relying on fixed VM names/MOIDs
from a previous run.

For the official `pulumi-vsphere` lab suite (nonempty exports, HTML report),
see [`pulumi-tests/`](../../pulumi-tests/README.md) or `make pulumi-tests`.
