HPE Morpheus Enterprise
1833065 Members
2652 Online
110049 Solutions
New Discussion

Using Ansible Collection in Air-Gapped Morpheus Environment

 
AungKT
Regular Advisor

Using Ansible Collection in Air-Gapped Morpheus Environment

I’m working in the environment that wasn't allowed to access Ansible-Galaxy and trying to execute Ansible playbook from Morpheus CMP that uses servicenow.itsm collection to create a Change Request in ServiceNow. The playbook works perfectly at the OS level but fails when executed as an Ansible task within Morpheus.

Scenairo: Morpheus isn't allowed to access Ansible Galaxy directly and can't use requirements.yml.

I manually installed servicenow.itsm into /opt/morpheus/embedded/rabbitmq/.ansible/collections/ansible_collections/servicenow/itsm/.

I updated ansible.cfg at: /usr/local/lib/python3.10/dist-packages/ansible/ansible.cfg with following content:

[defaults]

collections_paths = /opt/morpheus/embedded/rabbitmq/.ansible/collections

ansible --version confirms the correct config and collection path:

ansible [core 2.17.12]
config file = /usr/local/lib/python3.10/dist-packages/ansible/ansible.cfg
configured module search path = ['/opt/morpheus/embedded/rabbitmq/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible

Here is playbook sample:

- name: Create CR

  servicenow.itsm.change_request:

    instance: https://devXXXX.service-now.com

    username: "apiuser"

    password: "********"

It creates the change request successfully in ServiceNow when I run the playbook manually at the OS level.

When I run the same playbook from Morpheus CMP as an Ansible task, I get this error:

ERROR! couldn't resolve module/action 'servicenow.itsm.change_request'

 

Thanks in advance for any help or guidance!