

- Verify required system packages and environment
- Install the Claude Code CLI
- Authenticate the CLI (interactive browser flow)
- Validate Claude-generated Ansible ad-hoc commands and playbooks

1. Prepare the VM and shell
Switch to the student virtual machine and ensure you are in the home directory:2. Install Claude Code CLI
Install the CLI using the official installer script (curl piped to bash):3. Authenticate the CLI
Start the interactive login flow:

Claude models can make mistakes and prompts might include unsafe instructions. Be cautious when executing generated code or granting filesystem access.
claude login to retry if needed.
4. Quick verification: ask Claude for Ansible ad-hoc commands
Try a simple prompt to generate an Ansible ad-hoc ping command for your inventory:
Note on the Ansible ping module:
- The
pingmodule does not send ICMP packets; it executes a small Python task on the remote and returns “pong” on success. It verifies:- SSH connectivity
- SSH authentication
- Python availability on the remote host
5. Interactive mode: compose playbooks with natural language
Runclaude without flags to enter interactive mode. Use plain language or slash commands to control behavior and persist prompts:
webservers host group (not create a system group), update the playbook to set hosts: webservers and remove the group-creation task. Corrected example:
create_user.yml) and run it against your inventory:
Troubleshooting tips
- If
claudeis not found after installation, ensure~/.local/binis in your PATH: - If browser login fails, try the alternate login method (Anthropic Console) or re-run
claude login. - Always review generated code for security, prompt injection, and correctness before executing.
Helpful commands summary
Links and references
- Anthropic Claude
- Claude Code docs (install/login)
- Ansible Documentation — ad-hoc commands
- Ansible Documentation — playbooks