共计 559 个字符,预计需要花费 2 分钟才能阅读完成。
一、hostname 模块
hostname 模块用于修改主机名(注意: 它不能修改 /etc/hosts 文件)
https://docs.ansible.com/ansible/latest/modules/hostname_module.html#hostname-module
将 192.168.98.203 机器的主机名修改为 zutuanxue_node3 | |
[root@manage01 ~]# ansible -m hostname -a "name=zutuanxue_node3" 192.168.98.203 | |
"ansible_facts": {"ansible_domain": "", | {|
"ansible_fqdn": "zutuanxue_node3", | |
"ansible_hostname": "zutuanxue_node3", | |
"ansible_nodename": "zutuanxue_node3", | |
"discovered_interpreter_python": "/usr/libexec/platform-python" | |
}, | |
"changed": true, | |
"name": "zutuanxue_node3" | |
} | |
备注:批量修改需要使用 playbook 剧本 |
二、学习视频
正文完
星哥玩云-微信公众号
