How can I write variables inside the tasks file in ansible

后端 未结 5 1547
栀梦
栀梦 2021-01-31 07:26

I have this play.yml

---
- hosts: 127.0.0.1
  connection: local
  sudo: false

  tasks:
     - include: apache.yml

My Apache look

5条回答
  •  梦毁少年i
    2021-01-31 07:46

    I know, it is long ago, but since the easiest answer was not yet posted I will do so for other user that might step by.

    Just move the var inside the "name" block:

    - name: Download apache
      vars:
        url: czxcxz
      shell: wget {{url}} 
    

提交回复
热议问题