1、编辑文件hosts.tml
vim hosts.tml
【
---
- hosts: 192.168.59.103
remote_user: root
tasks:
- name: add hosts
lineinfile: name=/etc/hosts line="192.168.59.103 www.test3.com"
】
2、验证
ansible-playbook hosts.yml
标签:name,192.168,etc,ansible,hosts,tml From: https://www.cnblogs.com/leihongnu/p/16734952.html