当前位置: 首页> 教育> 就业 > 洛阳最新消息_敦煌网跨境电商平台_网络营销推广策略_长沙网络推广

洛阳最新消息_敦煌网跨境电商平台_网络营销推广策略_长沙网络推广

时间:2025/8/28 16:58:30来源:https://blog.csdn.net/dxgcbhj/article/details/142880577 浏览次数:0次
洛阳最新消息_敦煌网跨境电商平台_网络营销推广策略_长沙网络推广

1.先准备三台机子,一台ansible服务端、和两台客户端,配置客户端主机名、cinder和compute。

192.168.10.202ansible客户端
192.168.10.56cinder客户端
192.168.10.55compute客户端

2.下载ansible(客户端),准备repo文件。

#编写文件 vi openstack.repo
[base]
name=base
baseurl=https://repo.huaweicloud.com/centos/7/os/x86_64/
enable=1
gpgcheck=0
[extras]
name=extrax
baseurl=https://repo.huaweicloud.com/centos/7/extras/x86_64/
enable=1
gpgcheck=0
[updates]
name=updates
baseurl=https://repo.huaweicloud.com/centos/7/updates/x86_64/
enable=1
gpgcheck=0
[queens]
name=queens
baseurl=https://repo.huaweicloud.com/centos/7/cloud/x86_64/openstack-queens/
enable=1
gpgcheck=0
[virt]
name=virt
baseurl=https://repo.huaweicloud.com/centos/7/virt/x86_64/kvm-common/
enable=1
gpgcheck=0#下载ansible
yum -y install ansible

3.加入主机清单,两台客户端的ip,配置免密登录。

#进入文件vi /etc/ansible/hosts最后面加入192.168.10.56
192.168.10.55
#两台客户端的IP#配置免密登录ssh-keygen  #生成密钥
ssh-copy-id root@192.168.10.56  #拷贝密钥到目标主机
ssh-copy-id root@192.168.10.55 #拷贝密钥到目标主机

4.使用ping模块,检测受管主机的网络连通性。

#ping模块
ansible -m ping all #all表示所有主机

 5.基础模块:copy、file、user、shell、service、yum、mount、systemd、fetch等模块。

#fetch模块
ansible all  -m fetch -a 'src=/etc/hosts dest=/root'  (从客户端取东西到服务端)#copy模块
ansible all -m copy -a 'src=/root/aa dest=/opt/yz  #(复制文件到客户端)#file模块ansible all -m file -a 'path=/opt/bb state=absent'  #删除文件
ansible all -m file -a 'path=/opt/dd state=touch mode=777' #创建新文件,权限是777
ansible all -m file -a 'path=/opt/cc state=directory mode=777' #创建目录,权限是777#user模块
ansible all -m user -a 'name=aa group=root state=present' #创建用户#shell命令行模块(类似于command,但是shell支持特殊符号,command不支持)
ansible all -m shell -a 'cat /etc/passwd |grep aa'#service 服务模块
ansible all -m service -a 'name=httpd state=started enabled=true'  #(启动httpd,并开机自启)#yum模块
ansible all -m yum -a 'name=httpd state=present'  #安装httpd#mount 模块
ansible all -m mount -a 'path=/mnt scr=/dev/cdrom state=mounted fstype=iso9660'  #挂载光盘#systemd模块
ansible all -m systemd -a 'name=firewalld state=stopped enabled=no'  #(关闭防火墙)

6.以上就是ansible的基础模块。

关键字:洛阳最新消息_敦煌网跨境电商平台_网络营销推广策略_长沙网络推广

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: