cancel
Showing results for 
Search instead for 
Did you mean: 
Rabs
Mission Specialist
Mission Specialist
  • 1,985 Views

Adding non default path of roles and collections

Jump to solution

Hi All,

 

I need help to add roles and collections to the default path.

I added in the ansible.cfg, but i am unable use or see the roles and collections added. When I checked the default path are vailable.

How will I add the path so that I can see it where I want it to be.

 

Regards,

 

Rab

Labels (3)
Tags (1)
1 Solution

Accepted Solutions
Akyuz_Remzi
Mission Specialist
Mission Specialist
  • 1,974 Views

Hi,

It depend on your ansible version.

my lab ansible core version is 2.14.8 and ansible-navigator version is 3.3.1
If you use like as that version you can try to create new config file as shown below

If you dont have any ansible-navigator.yml you can try;

$ ansible-navigator settings --sample > /tmp/ansible-navigator.yml

$ mv -iv > /tmp/ansible-navigator.yml .

$ ansible-navigator config

then type:

:f role

:1                <-- Default roles path

Akyuz_Remzi_2-1693747370324.png

 

 

 

 

 

Akyuz_Remzi_3-1693747406013.pngAkyuz_Remzi_4-1693747437109.png

 

Example default config:


$ cat .ansible-navigator.yml
---
ansible-navigator:
ansible:
config:
path: .ansible.cfg
execution-environment:
image: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest
pull:
policy: missing

$ cat .ansible.cfg
[defaults]
collections_path = /home/remzi/.ansible/collections:./collections:/usr/share/ansible/collections
#collections_path={{ ANSIBLE_HOME ~ "/collections:/usr/share/ansible/collections" }}
# (boolean) A boolean to enable or disable scanning the sys.path for installed collections
collections_scan_sys_path=True
roles_path=/home/remzi/ansible/custom-roles:/usr/share/ansible/roles:/etc/ansible/roles

callbacks_enabled=ansible.posix.timer,ansible.posix.profile_tasks
ANSIBLE_JINJA2_NATIVE=true


[galaxy]
server_list = automation_hub,community

[galaxy_server.community]
url=https://galaxy.ansible.com

[galaxy_server.automation_hub]
url=https://console.redhat.com/api/automation-hub/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
token=MY_RHEL_TOKEN

I hope these words help to you.

Good luck.

View solution in original post

2 Replies
Akyuz_Remzi
Mission Specialist
Mission Specialist
  • 1,975 Views

Hi,

It depend on your ansible version.

my lab ansible core version is 2.14.8 and ansible-navigator version is 3.3.1
If you use like as that version you can try to create new config file as shown below

If you dont have any ansible-navigator.yml you can try;

$ ansible-navigator settings --sample > /tmp/ansible-navigator.yml

$ mv -iv > /tmp/ansible-navigator.yml .

$ ansible-navigator config

then type:

:f role

:1                <-- Default roles path

Akyuz_Remzi_2-1693747370324.png

 

 

 

 

 

Akyuz_Remzi_3-1693747406013.pngAkyuz_Remzi_4-1693747437109.png

 

Example default config:


$ cat .ansible-navigator.yml
---
ansible-navigator:
ansible:
config:
path: .ansible.cfg
execution-environment:
image: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest
pull:
policy: missing

$ cat .ansible.cfg
[defaults]
collections_path = /home/remzi/.ansible/collections:./collections:/usr/share/ansible/collections
#collections_path={{ ANSIBLE_HOME ~ "/collections:/usr/share/ansible/collections" }}
# (boolean) A boolean to enable or disable scanning the sys.path for installed collections
collections_scan_sys_path=True
roles_path=/home/remzi/ansible/custom-roles:/usr/share/ansible/roles:/etc/ansible/roles

callbacks_enabled=ansible.posix.timer,ansible.posix.profile_tasks
ANSIBLE_JINJA2_NATIVE=true


[galaxy]
server_list = automation_hub,community

[galaxy_server.community]
url=https://galaxy.ansible.com

[galaxy_server.automation_hub]
url=https://console.redhat.com/api/automation-hub/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
token=MY_RHEL_TOKEN

I hope these words help to you.

Good luck.

Rabs
Mission Specialist
Mission Specialist
  • 1,967 Views

Thank you very much. I am using ansible version 2.13

Join the discussion
You must log in to join this conversation.