This is an old revision of the document!


Ansible usage on GPU cluster

Just some instrauctions on how to use ansible on the GPU cluster.

Voor clusterwide commando’s suggereert Mike on ansible te gebruiken. Die ik krijg ik in ieder geval aan de praat:
`apt-get install ansible` op de machine waarvandaan je commando’s wilt uitvoeren
Daar een file `/etc/ansible/hosts` maken met zoiets:

```[artscluster_nodes]
arts[001:040].apertif

[artscluster_master]
arts041.apertif

[artscluster:children]
artscluster_nodes
artscluster_master```

De hosts file kan ook ergens anders staan, maar dan moet je `ANSIBLE_INVENTORY=/path/to/host/file` als envvar zetten.

Om commando’s uit te voeren: `ansible <hostgroup> -a "<command>"`

Om met een andere username in te loggen (Default is huidige user): `ansible -u apertif`

Om meer processen parallel te doen (Default is 5): e.g. `ansible -f 40`

Om alle software te herstarten zou je dus het volgende kunnen doen:
`ansible -u apertif -f 40 artscluster_nodes -a "sudo systemctl restart arts-nodes.service"`
`ansible -u apertif artscluster_master -a "sudo systemctl restart arts-survey.service"`

Wat doet ansible als een host niet reageert?

 Default timeout is 10s, daarna krijg je dit:
```[oostrum@hermes]~$ ansible test -a "hostname"
www.astron.nl | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host www.astron.nl port 22: Operation timed out", 
    "unreachable": true
}```

QR Code
QR Code wiki:user:ansible_artscluster (generated for current page)