ansible-playbook--jia使用

#cat jia.yml
- hosts: test-gfs
user: dev
gather_facts: true

vars:
PORT: "3306"
MESAGE: "wangrenqing"
IP_local: "{{ansible_default_ipv4.address}}"
IP_local_lan: "{{ ansible_all_ipv4_addresses[1] }}"
#HOST_NAME: "{{inventory_hostname}}
tasks:
- name: copy file to client
template: src=./test.j dest=/tmp/test.tmp
- debug: "msg={{ ansible_default_ipv4.address }}"

- name: "add file"
lineinfile: dest=/tmp/test.tmp line="{{PORT}}"

#cat ./test.j
this is {{PORT}} fsdfsdf {{MESAGE}}

ip_wan: {{IP_local}} ip_lan: {{IP_local_lan}}

猜你喜欢

转载自www.cnblogs.com/Qing-840/p/9264132.html