How To Use Ansible: Difference between revisions

From DISI
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 2: Line 2:
Ansible is provisioning tool for bare-metal and virtual machines.
Ansible is provisioning tool for bare-metal and virtual machines.


<big>'''These commands should only be used by privileged users.
'''<big> These commands should only be used by privileged users. </big>
Do not use these instructions if you do not have patience to read them. One mistake can be very bad.
 
'''</big>
<big> Do not use these instructions if you do not have patience to read them. </big>
 
<big> One mistake can be very bad.</big>
'''
 


== Instructions for Both Cluster 2 and 7 ==
== Instructions for Both Cluster 2 and 7 ==

Revision as of 22:50, 8 October 2026

Introduction

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

These commands should only be used by privileged users.

Do not use these instructions if you do not have patience to read them.

One mistake can be very bad.


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