网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

ansible相关命令备忘-创新互联

常用的ansible命令,备忘。

成都创新互联公司是一家专业提供合肥企业网站建设,专注与成都做网站、成都网站建设、H5网站设计、小程序制作等业务。10年已为合肥众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。

一、修改/etc/ansible/hosts文件,将需要操作的主机添加进去:

vi /etc/ansible/hosts

[ywbhost]

192.16.1.[29:52] ansible_ssh_uer="root" ansible_ssh_pass="xxxxxx"

二、执行shell命令:

ansible ywbhost -m shell -a "/tmp/setdns.sh"

三、复制文件

复制文件到远端主机copy:

ansible ywbhost -m copy -a " src=/etc/ansible/ywb/setdns.sh dest=/tmp/setdns.sh mode=755"

从远端主机拷贝文件到本机,fetch:

ansible ywbhost -m fetch -a " src=/tmp/setdns.sh dest=/tmp/setdns.sh mode=755"

四、文本操作:

1、在文末添加一行

ansible ywbhost -m lineinfile -a "dest=/etc/chrony.conf line='server 192.168.1.33 iburst'"

2、替换一行

ansible all -m lineinfile -a "dest=/root/test.txt regexp='bbb' line='bbbbbbb'"

3、在某一行前面插入一行:

ansible all -m lineinfile -a "dest=/root/test.txt insertbefore='aa(.*)' line='eeee'"

4、在某一行后面插入一行,insertafter

ansible all -m lineinfile -a "dest=/root/test.txt insertafter='aa(.*)' line='eeee'"

5、删除某一行:

ansible all -m lineinfile -a "dest=/root/test.txt regexp='aa(.*)' state=absent"

6、替换或添加某一行:ansible all -m lineinfile -a "dest=/root/test.txt regexp='he(.*)' line='lllll' state=present"

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文题目:ansible相关命令备忘-创新互联
本文地址:http://bjjierui.cn/article/ccjdps.html

其他资讯