FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
appendix:fabric-vs-others.html [2017/12/24 23:43] kurihara |
appendix:fabric-vs-others.html [2020/02/20 23:46] (current) kurihara |
||
---|---|---|---|
Line 1: | Line 1: | ||
[[: | [[: | ||
- | ======FastHandle(Fabric) vs Other Tools====== | + | ======Python |
\\ | \\ | ||
Line 7: | Line 7: | ||
\\ | \\ | ||
- | ===== Fasthandle(Fabric) vs Only ssh ===== | + | ===== Python |
*FastHandle can easily deploy many servers. | *FastHandle can easily deploy many servers. | ||
Line 14: | Line 14: | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ fab -H x.x.x.x | + | $ fab -H x.x.x.x |
- | $ fab -H x.x.x.x auth.stg -- hostname | + | |
vs | vs | ||
+ | |||
$ ssh x.x.x.x hostname | $ ssh x.x.x.x hostname | ||
$ ssh -i ~/ | $ ssh -i ~/ | ||
Line 25: | Line 26: | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ fab -H x.x.x.x | + | $ fab -H x.x.x.x |
- | $ fab -H x.x.x.x auth.pro -- "echo 'any host 192.168.100.1 gw 192.168.0.5' | + | |
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: | ||
- | $ fab -H x.x.x.x | + | $ fab -H x.x.x.x |
vs | vs | ||
+ | |||
$ ssh x.x.x.x | $ ssh x.x.x.x | ||
</ | </ | ||
Line 39: | Line 43: | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
$ H=" | $ H=" | ||
- | $ fab -H $H | + | $ fab -H $H |
vs | vs | ||
Line 48: | Line 52: | ||
\\ | \\ | ||
- | ===== Ansible ===== | + | ===== Ansible |
+ | http:// | ||
+ | |||
+ | *Ansible must be aware of the initial connection " | ||
+ | |||
+ | ==== Ansible Options ==== | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ vi hosts | + | $ 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] | [test-web] | ||
192.168.0.10 | 192.168.0.10 | ||
192.168.0.11 | 192.168.0.11 | ||
- | $ ansible test-web -i hosts -a ' | + | $ ansible test-web -i hosts_test |
</ | </ | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | $ ansible -i hosts -u user01 -k --ask-su-pass | + | $ 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.