Linux command
fabric 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run a shell command on a remote host
fab -H [host] -- [command]
Run a task defined in fabfile.py
fab [taskname]
Run a task on a specific host
fab -H [user@host] [taskname]
List all available tasks
fab --list
Run a task using a specific SSH key
fab -i [~/.ssh/key] -H [host] [taskname]
Show detailed help for a specific task
fab -d [taskname]
说明
Fabric is a Python library and command-line tool for executing shell commands on remote servers over SSH. It simplifies deployment, system administration, and automation tasks. Tasks are defined in a fabfile.py using Python. Fabric 2.x provides a cleaner API than version 1.x, with Connection objects and a simpler task decorator.
参数
- -H, --hosts _hosts_
- Comma-separated host list.
- -i _key_
- SSH identity file.
- -u, --user _user_
- SSH username.
- -l, --list
- List available tasks.
- -p, --password
- Prompt for SSH password.
- -d _task_
- Show task docstring.
- -- _command_
- Run shell command directly.
- -c, --config _file_
- Config file path.
- -r, --roles _roles_
- Roles to operate on.
FAQ
What is the fabric command used for?
Fabric is a Python library and command-line tool for executing shell commands on remote servers over SSH. It simplifies deployment, system administration, and automation tasks. Tasks are defined in a fabfile.py using Python. Fabric 2.x provides a cleaner API than version 1.x, with Connection objects and a simpler task decorator.
How do I run a basic fabric example?
Run `fab -H [host] -- [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -H, --hosts _hosts_ do in fabric?
Comma-separated host list.