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 }}"
posted @ 2023-01-19 17:41  mingtian是吧  阅读(41)  评论(0编辑  收藏  举报