How To Use Ansible: Difference between revisions

From DISI
Jump to navigation Jump to search
(Created page with "== Introduction == Ansible is provisioning tool for bare-metal and virtual machines. '''These commands should only be used by privileged users.''' == Cluster 2 == Important Notes/Variables * Scripts live in :<source> /etc/ansible </source> * List hosts : <source> ansible-inventory --list all </source> === Ansible Console ===")
 
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
Ansible is provisioning tool for bare-metal and virtual machines.
Ansible is provisioning tool for bare-metal and virtual machines.


'''These commands should only be used by privileged users.'''


== Cluster 2 ==
== Warning ==
'''<big> These commands should only be used by privileged users. </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 ==
Important Notes/Variables
Important Notes/Variables
* Scripts live in
* Ansible Head Nodes
** Cluster 2: epyc
** Cluster 7: login01
* Ansible path is
:<source>
:<source>
/etc/ansible
/etc/ansible
</source>
</source>
* List hosts
* List hosts in the inventory file
: <source>
: <source>
ansible-inventory --list all
ansible-inventory --list all
OR
cat /etc/ansible/hosts
</source>
</source>


=== Ansible Console ===
=== 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

Latest revision as of 22:51, 8 October 2026

Introduction

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


Warning

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