2017-04-25 3 views
0

の機能をinclude_varswith_first_foundと一緒にテストしています。アシスタント - 変数を動作させることができません

私の脚本は

--- 
- name: Load Variables from files. 
    include_vars: "{{ item }}" 
    with_first_found: 
    - "a.yml" 
    - "b.yml" 
    - "default.yml" 

- name: another play 
    hosts: all 
    tasks: 
    - debug: msg="hello {{ http_port }}" 

である。しかしイムがこれを実行しているとき、私はエラーを取得し、

# ansible-playbook -i inventory/plat-inventory test.yaml 
ERROR! 'with_first_found' is not a valid attribute for a Play 

The error appears to have been in '/root/config-3.0.98/ansible/test.yaml': line 2, column 3, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 

--- 
- name: Load Variables from files. 
^here 

default.yml状態:

http_port: 80 

私はここで何をしないのですか?

答えて

2

私の知る限りでは、include_vars

- name: playbook 
    hosts: somehosts 
    gather_facts: false 
    tasks: 
    - name: "add some vars" 
     include_vars: somefile.yml 

ようits documentation

何かの例として、タスクでなければなりません。しかし、その後、これらの変数は、おそらく他の脚本では使用できません。

関連する問題