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}}

posted @ 2018-07-04 16:57  清风木  阅读(187)  评论(0编辑  收藏  举报