Centos7部署輕量級自動化運維工具pssh
pssh是由python編寫,可以在多臺伺服器執行 的工具。在伺服器越來越多的企業這種自動化運維工具越來越火。 |
下載pssh安裝包
[root@localhost ~]# wget
安裝依賴包
[root@localhost ~]# yum install -y make gcc gcc++ python-devel python-pip
安裝pssh
[root@localhost ~]# tar xf pssh-2.3.1.tar.gz [root@localhost ~]# cd pssh-2.3.1 [root@localhost ~]# python setup.py install
配置免密登入
[root@localhost ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:3antaxjGw+hdgfSlrXLYhUe5vgHe9b0ehh/gUY9E8Eg root@localhost.localdomain The key's randomart image is: +---[RSA 2048]----+ | E... | | .. ++ | | . o.*oo | | ...*o*.o| | S+.+o@..+| | . OoB B o| | . o.B.o *.| | . o.. +.o| | .o..o | +----[SHA256]-----+ [root@localhost ~]# cd /root/.ssh/ [root@localhost .ssh]# ls id_rsa id_rsa.pub [root@localhost .ssh]# ssh-copy-id 172.16.1.112 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" The authenticity of host '172.16.1.112 (172.16.1.112)' can't be established. ECDSA key fingerprint is SHA256:yFvaxR1x5YDhhe+6xR/Ou6Sm+YPYvPAoiLVKt9mAnXA. ECDSA key fingerprint is MD5:0d:c4:79:bc:36:7a:a4:82:95:4f:d5:d0:a3:c8:7d:2e. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@172.16.1.112's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh '172.16.1.112'" and check to make sure that only the key(s) you wanted were added. [root@localhost .ssh]# ssh-copy-id 172.16.1.16 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" The authenticity of host '172.16.1.16 (172.16.1.16)' can't be established. ECDSA key fingerprint is SHA256:ANzlXzrGA87YLI2vzkPJ/iNPiSQ5JStJc95948jE8aw. ECDSA key fingerprint is MD5:f9:f1:1b:5a:99:64:d8:d8:e9:9b:e6:bb:c3:d5:bd:e7. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@172.16.1.16's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh '172.16.1.16'" and check to make sure that only the key(s) you wanted were added.
測試免密登入
[root@localhost ~]# ssh 172.16.1.112 Last login: Tue Jun 2 09:44:24 2020 from 172.16.1.16 [root@localhost ~]# ssh 172.16.1.16 Last login: Tue Jun 2 09:30:47 2020 from 172.16.1.100
測試pssh
建立aaa檔案存放ip地址
[root@localhost ~]# cat aaa 172.16.1.16 172.16.1.112
批次執行date
[root@localhost ~]# pssh -h aaa -l root -P "date" 172.16.1.16: 2020年 06月 02日 星期二 09:59:48 CST [1] 09:59:48 [SUCCESS] 172.16.1.16 172.16.1.112: 2020年 06月 02日 星期二 09:59:48 CST [2] 09:59:48 [SUCCESS] 172.16.1.112
檢視磁碟
[root@localhost ~]# pssh -h aaa -l root -P "lsblk" 172.16.1.16: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm [SWAP] sr0 11:0 1 4.2G 0 rom [1] 10:13:02 [SUCCESS] 172.16.1.16 172.16.1.112: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm [SWAP] sr0 11:0 1 4.2G 0 rom [2] 10:13:03 [SUCCESS] 172.16.1.112
pssh部署完畢!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31524109/viewspace-2773225/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 輕量級自動化運維工具pssh與pslurp運維
- linux運維工具psshLinux運維
- Ansible自動化運維工具運維
- 自動化運維工具Ansible介紹運維
- 簡化IT運維工作,就要學會使用自動化運維工具!運維
- IT運維之自動化運維運維
- 自動化運維工具——ansible詳解(一)運維
- 自動化運維工具——ansible詳解(二)運維
- 自動化運維工具ansible的實踐運維
- 自動化運維工具之Puppet模組運維
- [Linux]Ansible自動化運維② - 工具與模組Linux運維
- 基於gogs和drone的一個輕量級的開發部署自動化流程Go
- Ansible 運維自動化 ( 配置管理工具 )運維
- 自動化運維工具之Puppet常用資源(二)運維
- 自動化運維工具之Puppet常用資源(一)運維
- 自動化運維工具之Puppet基礎入門運維
- 【nodejs原理&原始碼賞析(9)】用node-ssh實現輕量級自動化部署NodeJS原始碼
- 如何高效地遠端部署?自動化運維利器 Fabric 教程運維
- Python自動化部署工具-FabricPython
- 什麼是自動化運維?為什麼選擇Python做自動化運維?運維Python
- 輕量級超級 css 工具CSS
- 基於 Nebula Operator 的 K8s 自動化部署運維K8S運維
- ansible自動化運維入門運維
- 分層運維自動化監控運維
- 自動化運維的快速演進運維
- ansible自動化運維資料庫運維資料庫
- 自動化運維發展趨勢以及好用工具推薦運維
- 專案輕量級部署神器:Fabric
- 指標是構築自動化運維與智慧化運維的基石指標運維
- Linux Shell互動式自動化運維程式Linux運維
- python輕量級效能工具-LocustPython
- 降本增效 百TB級Redis自動化運維體系建設Redis運維
- 阿里雲釋出ECS自動化運維套件,幫助企業實現自動化運維轉型阿里運維套件
- 運維自動化之賬單系統運維
- Oracle 自動化運維-Python連線OracleOracle運維Python
- 論IT運維自動化的重要性運維
- Python自動化運維之IPy模組Python運維
- Python+Django+Ansible Playbook自動化運維PythonDjango運維