FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
appendix:fabric-vs-others.html [2017/12/16 22:50] kurihara created |
appendix:fabric-vs-others.html [2020/02/20 23:46] (current) kurihara |
||
---|---|---|---|
Line 1: | Line 1: | ||
[[: | [[: | ||
- | ======FastHandle(Fabric) vs Other Tools====== | + | ======Python |
- | ===== Fasthandle(Fabric) vs Only ssh ===== | + | \\ |
+ | {{INLINETOC}} | ||
+ | \\ | ||
+ | |||
+ | ===== Python | ||
*FastHandle can easily deploy many servers. | *FastHandle can easily deploy many servers. | ||
*FastHandle keep Password and PublicKey and Passphrase | *FastHandle keep Password and PublicKey and Passphrase | ||
- | *FastHandle | + | *<wrap hi>FastHandle can use ' and " like local server.</ |
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ echo x.x.x.x | fab auth.pro | + | $ fab -H x.x.x.x |
- | $ echo x.x.x.x | + | |
vs | vs | ||
+ | |||
$ ssh x.x.x.x hostname | $ ssh x.x.x.x hostname | ||
$ ssh -i ~/ | $ ssh -i ~/ | ||
Line 21: | Line 26: | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ echo x.x.x.x | + | $ fab -H x.x.x.x |
vs | vs | ||
+ | |||
$ ssh -t x.x.x.x sudo "bash -c 'echo \"any host 192.168.100.1 gw 192.168.0.5\" | $ ssh -t x.x.x.x sudo "bash -c 'echo \"any host 192.168.100.1 gw 192.168.0.5\" | ||
</ | </ | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ echo x.x.x.x | + | $ fab -H x.x.x.x |
vs | vs | ||
+ | |||
$ ssh x.x.x.x | $ ssh x.x.x.x | ||
</ | </ | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ fab -H 192.168.0.10, 192.168.0.11, 192.168.0.13 | + | $ H="192.168.0.1,192.168.0.2" |
- | + | $ fab -H $H -- hostname | |
- | $ vi tmp | + | |
- | 192.168.0.10 | + | |
- | 192.168.0.11 | + | |
- | 192.168.0.12 | + | |
- | $ cat | fab auth.pro | + | |
vs | vs | ||
Line 45: | Line 49: | ||
$ H=" | $ H=" | ||
$ for i in $H ; do ssh -n $i " | $ for i in $H ; do ssh -n $i " | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | ===== Ansible Ad-Hoc Commands===== | ||
+ | http:// | ||
+ | |||
+ | *Ansible must be aware of the initial connection " | ||
+ | |||
+ | ==== Ansible Options ==== | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ ansible -h | ||
+ | Usage: ansible < | ||
+ | |||
+ | Options: | ||
+ | -a MODULE_ARGS, | ||
+ | module arguments | ||
+ | --ask-vault-pass | ||
+ | |||
+ | -i INVENTORY, --inventory-file=INVENTORY | ||
+ | specify inventory host path | ||
+ | (default=/ | ||
+ | list. | ||
+ | -m MODULE_NAME, | ||
+ | module name to execute (default=command) | ||
+ | |||
+ | Connection Options: | ||
+ | -k, --ask-pass | ||
+ | --private-key=PRIVATE_KEY_FILE, | ||
+ | -u REMOTE_USER, | ||
+ | connect as this user (default=None) | ||
+ | |||
+ | Privilege Escalation Options: | ||
+ | -s, --sudo | ||
+ | become) | ||
+ | -U SUDO_USER, --sudo-user=SUDO_USER | ||
+ | desired sudo user (default=root) (deprecated, | ||
+ | become) | ||
+ | -S, --su run operations with su (deprecated, | ||
+ | --ask-sudo-pass | ||
+ | --ask-su-pass | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Example ==== | ||
+ | <sxh bash toolbar: | ||
+ | $ ansible -i 192.168.0.10, | ||
+ | $ ansible -i 192.168.0.10, | ||
+ | |||
+ | $ ansible -i 192.168.0.10, | ||
+ | $ ansible -i 192.168.0.10, | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | >The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like “<”, “>”, “|”, “;” and “&” will not work (use the shell module if you need these features). | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ ansible -i 192.168.0.30, | ||
+ | $ ansible -i 192.168.0.30, | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | <sxh bash toolbar: | ||
+ | $ ansible -i 192.168.0.10, | ||
+ | SSH password: | ||
+ | 192.168.0.10 | SUCCESS | rc=0 >> | ||
+ | root | ||
+ | </ | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ vi hosts_test | ||
+ | [test-web] | ||
+ | 192.168.0.10 | ||
+ | 192.168.0.11 | ||
+ | |||
+ | $ ansible test-web -i hosts_test -a ' | ||
+ | </ | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ ansible -i hosts_test | ||
+ | </ | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ ansible -s -K -B 1 -a " | ||
</ | </ | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.