网站建设价格标准渠道,仿 手机 网站模板html源码下载,分类信息网站程序,wordpress数据库安全ansible模块#xff1a;
ansible是基于模块来工作的#xff0c;本身没有批量部署的能力#xff0c;真正具有批量部署的是ansible所运行的模块#xff0c;ansible只是提供一个框架。
ansible支持的模块非常多#xff0c;我们并不需要把每个模块记住#xff0c;而只需要熟…
ansible模块
ansible是基于模块来工作的本身没有批量部署的能力真正具有批量部署的是ansible所运行的模块ansible只是提供一个框架。
ansible支持的模块非常多我们并不需要把每个模块记住而只需要熟悉一些常见的模块其他的模块在需要的需要用到的时候查询即可。
列出所有模块 [rootlocalhost ansible]# ansible-doc -l | wc -l
3387hostname模块
hostname模块用于修改主机名。注意它不能修改/etc/hosts文件。
将其中一台远程主机名修改为agent1.cluster.com
[rootlocalhost ansible]# ansible 192.168.17.105 -m hostname -a nameagent1.cluster.com
192.168.17.105 | CHANGED {ansible_facts: {ansible_domain: cluster.com,ansible_fqdn: ec2-3-64-163-50.eu-central-1.compute.amazonaws.com,ansible_hostname: agent1,ansible_nodename: agent1.cluster.com,discovered_interpreter_python: /usr/bin/python},changed: true,name: agent1.cluster.com
}然后再到192.168.17.105的主机上去检查发现hostname已经改成了agent1.cluster.com。
[rootlocalhost ansible]# ansible 192.168.17.106 -m hostname -a nameagent2.cluster.com
192.168.17.106 | CHANGED {ansible_facts: {ansible_domain: eu-central-1.compute.amazonaws.com,ansible_fqdn: ec2-3-64-163-50.eu-central-1.compute.amazonaws.com,ansible_hostname: agent2,ansible_nodename: agent2.cluster.com,discovered_interpreter_python: /usr/bin/python},changed: true,name: agent2.cluster.com
}检查hostname发现更新成功。
[rootlocalhost ~]# hostname
agent2.cluster.com