Junos OS를 실행하는 디바이스 관리 시 Ansible 수집, 역할 및 모듈 오류 문제 해결
문제
설명
Ansible 플레이북을 실행하는 동안 제어 노드는 수집 또는 Juniper.junos
역할을 찾지 못했거나 작업에서 아무런 조치도 탐지되지 않았거나 모듈을 해결할 수 없는 오류를 juniper.device
생성합니다. 예를 들어:
ERROR! the role 'Juniper.junos' was not found in /usr/share/ansible/roles:/etc/ansible/roles ...
또는
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
또는
ERROR! couldn't resolve module/action 'facts'. This often indicates a misspelling, missing collection, or incorrect module path.
원인
Ansible 제어 노드는 컬렉션이나 역할 및 관련 모듈을 Juniper.junos
찾을 juniper.device
수 없습니다.
솔루션
juniper.device
컬렉션과 Juniper.junos
역할은 Ansible Galaxy 웹 사이트에서 호스팅됩니다. 수집 또는 역할에서 모듈을 사용하려면 Ansible 제어 노드에 컬렉션이나 역할을 설치하고 플레이북에서도 참조해야 합니다.
Ansible 제어 노드에 컬렉션을 설치 juniper.device
하려면 명령을 실행하고 ansible-galaxy collection install
을 지정합니다 juniper.device
.
user@ansible-cn:~$ sudo ansible-galaxy collection install juniper.device
Ansible 제어 노드에 역할을 설치 Juniper.junos
하려면 명령을 실행하고 ansible-galaxy install
를 지정합니다 Juniper.junos
.
user@ansible-cn:~$ sudo ansible-galaxy install Juniper.junos
컬렉션 또는 역할을 기본 위치에 설치하지 않는 경우 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 }}"
역할 모듈을 Juniper.junos
사용하려면 플레이북 플레이에 역할을 포함해야 합니다. 예를 들어:
--- - name: Get Device Facts hosts: junos-all connection: local gather_facts: no roles: - Juniper.junos tasks: - name: Get device facts juniper_junos_facts: savedir: "{{ playbook_dir }}"