ansible-批量修改主机名

匿名 (未验证) 提交于 2019-12-03 00:39:02

修改cat /etc/ansible/hosts


[test]
10.27.235.108 host_name=test_host_name

- hosts: test
user: root
gather_facts: true
tasks:
- name: rsync dir filebeat
hostname: ‘name={{ host_name }}‘
- name: "add line"
lineinfile:
dest: /etc/hosts
line: "{{ ansible_all_ipv4_addresses[0] }} {{ host_name }}"

原文:https://www.cnblogs.com/Qing-840/p/9264117.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!