CentOS 7 安装 Ansible
  dIZ4mPo2q5Ch 2023年11月02日 23 0


ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。

配置

192.168.1.73        ansible

192.168.1.114      client

192.168.1.115      client

1、安装 

yum install epel-release -y

yum install ansible -y

2、配置 ssh

ssh-keygen

ssh-copy-id root@192.168.1.114

ssh-copy-id root@192.168.1.114

3、添加主机列表

vi /etc/ansible/hosts

[testgroup]
192.168.1.114
192.168.1.115

4、批量ping

ansible testgroup -m ping

192.168.1.115 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
192.168.1.114 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}

 5、批量安装 wget

ansible testgroup -m shell -a "yum install wget -y"

6、批量拷贝

ansible testgroup -m copy -a "src=/root/anaconda-ks.cfg dest=/opt"

7、Ansible常用模块详解


 

 

 

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  fl0iHpTOb5wE   2023年11月13日   31   0   0 linuxpythonCentOS
  fl0iHpTOb5wE   2023年11月13日   27   0   0 Tensorflowlinuxpython
  nQkVcpdWfLDr   2023年11月13日   42   0   0 数组sort函数python
dIZ4mPo2q5Ch