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 ===")
 
No edit summary
Line 4: Line 4:
'''These commands should only be used by privileged users.'''
'''These commands should only be used by privileged users.'''


== Cluster 2 ==
== 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 ===

Revision as of 22:30, 8 October 2026

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