2017-12-22 8 views
0

저는 Anstanding에 익숙하지 않아 "with_items"를 사용하여 경로의 항목을 반복 할 수없는 것처럼 보입니다.가능 - 경로의 항목을 반복하는 데 문제가 있습니다.

다음은 경로의 일부 파일을 통과하여 주니퍼 라우터에 구성을 적용하기위한 샘플 코드입니다.

--- 
- name: Get Juniper Device Facts 
    hosts: "junos_devices" 
    gather_facts: false 
    connection: local 
tasks: 
    - name: Update prefix-lists 
    junos_config: 
     src: prefix-lists/{{item}} 
    with_items: "/home/python/prefix-lists/*" 

내가지고있어 오류가 이것이다 :

failed: [192.168.216.66] (item=/home/python/prefix-lists/*) => {"changed": false, "failed": true, "item": "/home/python/prefix-lists/*", "msg": "path specified in src not found"} 

내가 그렇게 할 수 없어요 왜 사람이 어떤 생각을 가지고 있습니까?

답변

2

with_items? with_fileglob을 사용하십시오. 예부터

:

# copy each file over that matches the given pattern 
- name: Copy each file over that matches the given pattern 
    copy: 
    src: "{{ item }}" 
    dest: "/etc/fooapp/" 
    owner: "root" 
    mode: 0600 
    with_fileglob: 
    - "/playbooks/files/fooapp/*" 
+0

안녕 콘스탄틴, 대신 with_items의 with_fileglob를 사용하여 당신의 도움에 대해 감사했다. – jitter

+1

사실 Anfactory는 반복 파일에서 구성을 적용하지 않기 때문에 실제로 작동하지 않습니다. – jitter

관련 문제