Junos 디바이스 관리 시 Ansible 수집 및 모듈 오류 문제 해결
문제
묘사
Ansible 플레이북을 실행하는 동안 제어 노드는 컬렉션을 찾을 수 없거나, 작업에서 작업이 감지되지 않았거나, 모듈을 확인할 수 없다는 오류를 juniper.device
생성합니다. 예를 들어:
ERROR! couldn't resolve module/action 'juniper.device.facts'. This often indicates a misspelling, missing collection, or incorrect module path.
또는
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
원인
Ansible 제어 노드가 juniper.device
컬렉션 및 관련 모듈을 찾을 수 없습니다.
용액
컬렉션은 juniper.device
Ansible Galaxy 웹 사이트에서 호스팅됩니다. 컬렉션에서 모듈을 사용하려면 Ansible 제어 노드에 컬렉션을 설치하고 플레이북에서도 참조해야 합니다.
Ansible 제어 노드에 컬렉션을 설치 juniper.device
하려면 명령을 실행하고 ansible-galaxy collection install
을 지정합니다 juniper.device
.
user@ansible-cn:~$ ansible-galaxy collection install juniper.device
메모:
기본 위치에 컬렉션을 설치하지 않는 경우 Ansible 설정에서 경로를 정의해야 할 수 있습니다. 컬렉션 설치 및 경로 지정에 대한 자세한 내용은 공식 Ansible 설명서를 참조하세요.
컬렉션 모듈을 사용하려면 juniper.device
모듈을 실행할 때 정규화된 컬렉션 이름을 참조합니다. 예를 들어:
--- - name: Get Device Facts hosts: junos-all connection: local gather_facts: no tasks: - name: Get device facts juniper.device.facts: savedir: "{{ playbook_dir }}"