playbook 之 set_fact
在tasks 中注册变量set_fact
,该变量可以跨tasks调用
- hosts: 127.0.0.1
tasks:
- set_fact:
var: "value"
- name:
debug:
msg: "{{ var }}"
- hosts: 127.0.0.1
tasks:
- name:
debug:
msg: "{{ var }}"
在tasks 中注册变量set_fact
,该变量可以跨tasks调用
- hosts: 127.0.0.1
tasks:
- set_fact:
var: "value"
- name:
debug:
msg: "{{ var }}"
- hosts: 127.0.0.1
tasks:
- name:
debug:
msg: "{{ var }}"