Junos 디바이스 관리 시 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.device
콜렉션 또는 Juniper.junos
역할 및 연관된 모듈을 찾을 수 없습니다.
솔루션
컬렉션과 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 }}"