using ansible to do status checks on systems from remote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Want to check on a set of hosts but you don't have root/sudo access on lockbox? Want to do it in a way that you can hit the host quickly w/o having to do them one by one?

Here's how you can use ansible from your local computer to do it:

1. check out ansible:
   git clone git://github.com/ansible/ansible.git

2. get a copy of our host inventory:
   ssh lockbox01 "pushd /srv/web/infra/hosts>>/dev/null; for host in
                     *.org; do echo \$host; done" >> ~/fedora-inv

3. make sure your ~/.ssh/config file lets you bounce through bastion for fedora hosts:

Host *.phx2.fedoraproject.org *.vpn.fedoraproject.org *.qa.fedoraproject.org
      IdentityFile ~/.ssh/fedora-rsa
      VerifyHostKeyDNS yes
      ProxyCommand ssh -q bastion.fedoraproject.org nc %h %p

4. cd into the ansible checkout dir:

5. setup the ansible environment:

   . ./hacking/env-setup

6. run your commands like this:
   ansible -c ssh -u skvidal -i ~/fedora-inv  app??.phx2* -a uptime

   that reads:
- use the ssh connectory as user skvidal with ~/fedora-inv as the inventory file. Connect to the hosts app??.phx2* and run the command module (the default module) with argument of "uptime"

the output looks like this:
app07.phx2.fedoraproject.org | success | rc=0 >>
21:20:34 up 3 days, 23:22,  1 user,  load average: 0.00, 0.03, 0.00

app02.phx2.fedoraproject.org | success | rc=0 >>
21:20:34 up 3 days, 22:00,  5 users,  load average: 2.41, 2.26, 3.27

app03.phx2.fedoraproject.org | success | rc=0 >>
21:20:34 up  1:27,  3 users,  load average: 3.09, 3.89, 6.39

app04.phx2.fedoraproject.org | success | rc=0 >>
21:20:34 up 3 days, 23:24,  2 users,  load average: 3.68, 3.11, 12.08

app01.phx2.fedoraproject.org | success | rc=0 >>
21:20:34 up 3 days, 21:39,  7 users,  load average: 1.80, 2.03, 8.66



please do try to use this sensibly :)

-sv

_______________________________________________
infrastructure mailing list
infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/infrastructure



[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux