How To Use Ansible

From DISI
Revision as of 22:46, 8 October 2026 by Jgutierrez6 (talk | contribs)
Jump to navigation Jump to search

Introduction

Ansible is provisioning tool for bare-metal and virtual machines.

These commands should only be used by privileged users.

Instructions for Both Cluster 2 and 7

Important Notes/Variables

  • Ansible Head Nodes
    • Cluster 2: epyc
    • Cluster 7: login01
  • Ansible path is
/etc/ansible
  • List hosts in the inventory file
ansible-inventory --list all
OR
cat /etc/ansible/hosts

Ansible Console

To access a terminal interface use the below command

ansible-console -bkK <optional flags>

Examples:

ansible-console -bkK
ansible-console -bkK -l zfs
ansible-console -bkK -l slurmd

An ansible-console command without other flags will SSH into all defined hosts in the inventory list.

Must-Have Flags

  • -b, --become run operations with become (does not imply password prompting)
  • -k, --ask-pass ask for connection password
  • -K, --ask-become-pass

Optional Useful Flags

  • -l SUBSET, --limit SUBSET
  • -T TIMEOUT, --timeout TIMEOUT

Ansible Playbook

To run full instructions or playbooks

ansible-playbook -bkK <path_to_instructions.yml>

The playbooks are located in

/etc/ansible/playbooks

The directories are labeled

  • maintenance - to check disks and hardware
  • slurm - install and maintain slurm software and configs
  • system - provisioning bare metal and virtual machines

Must-Have Flags

  • -b, --become run operations with become (does not imply password prompting)
  • -k, --ask-pass ask for connection password
  • -K, --ask-become-pass