Ansible主机已经安装完成Ansible自动化运维----yum源的方式安装ansible(国内镜像)
现在我们来尝试用ansible向远程主机172.25.65.11 \ 172.25.65.12
部署Apache服务
[devops@server10 ansible]# cat hosts
[test]
172.25.65.11
172.25.65.12
- 使用下面命令对组
test
中的主机安装httpd
[devops@server10 ansible]# ansible test -m yum -a "name=httpd state=present"
-m:
接方式
-a:
command
state:
present 状态表示安装
- 使用下面命令允许组
test
中的主机的火墙接受http服务
[root@server10 ansible]# ansible test -m firewalld -a "service=http state=enabled"
server11 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"msg": "Non-permanent operati