python自动化 百度网盘,python办公自动化教程 网盘
一、部署前确保多主机安全:
#ssh配置免加密(比如主机A想不加密登录主机B(B(10 . 4 . 7 . 11)),请在主机A上运行以下命令:ssh-copy-id root@10.4.7.11 #)提示输入主机B的密码,然后返回车上完成免加密。另外,只要有C和D主机依次在主机A上执行ssh-copy-id root@C和Dip。(因为主机A计划作为ansible server,所以必须禁止其他节点访问主机))如果主机A没有公钥,那么报错,请在主机A上运行ssh-keygen命令())(主机A作为ansible管理主机。)
# repo[root @ dw01 ~]# yum install-y https://dl。fedora project.org/pub/epel/epel-release-latest-7.noarch]检查ansible版本[root @ dw01 ~]# ansi ble-version asible 2 . 9 . 2 CCC ansi ble . CFG configured modulesearch path=[u ]u /usr/share/ansi ble/plugins/modules ]ansiblepythonmodulelocation=/usr/lib/python 2.7/site-packages/
[root @ dw01 ~]# vim/etc/ansi ble/hosts[all]10 . 4 . 7 . 1010 . 4 . 7 . 11四.测试Ansible
Ping模块用于测试ansible和被控方之间的连通性。
[root@m01 ~]# ansible all -m ping
成功={
ansible_facts :
discovered _ interpreter _ python ://usr/高个太阳镜/python
(,
Change :假,
Ping :安静的天鹅 }
成功={
ansible_facts :
discovered _ interpreter _ python ://usr/高个太阳镜/python
(,
Change :假,
Ping :安静的天鹅 }
5.密码连接
//方法一,主机端口密码vim/etc/ansi ble/hosts[web server]10 . 0 . 0 . 41 ansi ble _ ssh _ port=22 ansi ble _ ssh _ u u u u user=
# all for batch running iptables policy on host A is/etc/ansi ble/添加到主机的模块:ansi ble all-m shell-all iptables-tnat-iout put-d 10 . 100 . 31 . 19-ptcp-mtcp-dport 1521-JD nan要编辑hosts中的模块,单击# multiple hosts hosts sans iblek 8s-m shell-A echo ptah.kxjlcc.com,119.3.222.170/etc/hosts #修改m的权限N dest=/tmp/b.txt #在远程计算机上创建文件夹ansi ble K8s-mfile-a path=/lzmly 2 state=directory #以便在远程计算机上创建文件。 aali创建软连接的src是源地址,Path是目标地址ansi ble k8s-mfile-a Path=/tmp/fsrc=/etc/fstab state=link #文件或文件夹ank要更改主机密码ansi ble-playbook root _ passwd . yaml # ansi ble请批量使用自己的语法将需求写入YAML文件,然后点击ansi ble-playbook仅供参考-hosts 3360 all sudo:yes remote _ user:xxxx gather _ facts 3360}-{用户3360
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。