Not able to install TYK API Gateway

HI, I am trying to setup tyk API gateway. Below are the environment details:
Red Hat Enterprise Linux Server release 7.9 (Maipo)
ansible 2.9.25
python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

When I am running below command as part of the setting up. I am getting error.

ansible-playbook playbook.yaml -t tyk-ce -t redis

Error:

<<
‘community.mongodb.mongodb_repository’ was not found in /home/ec2-user/tyk-ansible/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/ec2-user/tyk-ansible

The error appears to be in ‘/home/ec2-user/tyk-ansible/playbook.yaml’: line 20, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

roles:
- community.mongodb.mongodb_repository
^ here

Please help to resolve this issue, I have googled a lot but not getting any lead towards solution.

Hi @saloni512, welcome to the community.

Could you try following a thread with a similar issue here Installation Error and let us know if you progressed pass the error.

HI Support Team,

I have already tried that but its not working and for RHEL the latest ansible version available is 2.9. Please help further.

Thanks & Regards,
Saloni

Hello @saloni512

Can you please run the following command and show me the results?

ansible-galaxy collection list

Zaid

Hi @saloni512

This worked for me on CentOS 7

sudo yum -y remove ansible
sudo yum -y install python3-pip 
sudo pip3 install --upgrade pip
sudo /usr/local/bin/pip3 install ansible
sh scripts/init.sh

setup hosts.yaml

ansible-playbook playbook.yaml -t tyk-ce -t redis

Since you have no need of mongo for a CE install, another option is to remove the mongo section from the playbook

Cheers,
Pete

1st 3 command is successful.
for the 4th command below is the output:

[root@ip-10-10-31-38 ec2-user]# /usr/local/bin/pip3 install ansible
Requirement already satisfied: ansible in /usr/local/lib/python3.6/site-packages (4.6.0)
Requirement already satisfied: ansible-core<2.12,>=2.11.5 in /usr/local/lib/python3.6/site-packages (from ansible) (2.11.5)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.6/site-packages (from ansible-core<2.12,>=2.11.5->ansible) (3.0.1)
Requirement already satisfied: PyYAML in /usr/local/lib64/python3.6/site-packages (from ansible-core<2.12,>=2.11.5->ansible) (5.4.1)
Requirement already satisfied: cryptography in /usr/local/lib64/python3.6/site-packages (from ansible-core<2.12,>=2.11.5->ansible) (3.4.8)
Requirement already satisfied: packaging in /usr/local/lib/python3.6/site-packages (from ansible-core<2.12,>=2.11.5->ansible) (21.0)
Requirement already satisfied: resolvelib<0.6.0,>=0.5.3 in /usr/local/lib/python3.6/site-packages (from ansible-core<2.12,>=2.11.5->ansible) (0.5.4)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib64/python3.6/site-packages (from cryptography->ansible-core<2.12,>=2.11.5->ansible) (1.14.6)
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.12->cryptography->ansible-core<2.12,>=2.11.5->ansible) (2.20)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib64/python3.6/site-packages (from jinja2->ansible-core<2.12,>=2.11.5->ansible) (2.0.1)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.6/site-packages (from packaging->ansible-core<2.12,>=2.11.5->ansible) (2.4.7)
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.11.2 documentation

[root@ip-10-10-31-38 tyk-ansible]# sh scripts/init.sh
scripts/init.sh: line 3: ansible-galaxy: command not found

Getting above error, seems ansible is not installed,. Even I tried to run ansible as below but its giving ansible not found.

[root@ip-10-10-31-38 tyk-ansible]# ansible
bash: ansible: command not found

Please assist further

Could you try the command on a fresh install of RHEL. Then remove the mongodb section in the playbook.yaml file when running the command

ansible-playbook playbook.yaml -t tyk-ce -t redis

The Community Edition only requires redis as a dependency.

Thanks for your support and response, It worked. But can you Please confirm removing mongodb tags won’t impact the functionality of tyk api gateway in any way?

In addition to above now I am getting below error, which seems related to pem file configuration. So just wondering which pem file we need to use here. should I generate 1 selfsigned cert and use.

<<<

ansible-playbook playbook.yaml -t tyk-ce -t redis

PLAY [redis] ************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host redis: Failed to connect to the host via ssh: Warning: Permanently added
ec2-18-142-155-240.ap-southeast-1.compute.amazonaws.com,10.10.31.38’ (ECDSA) to the list of known hosts. no such identity: ./secret.pem: No such file or
directory Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: [redis]: UNREACHABLE! => {“changed”: false, “msg”: “Data could not be sent to remote host "ec2-18-142-155-240.ap-southeast-1.compute.amazonaws.com". Make sure this host can be reached over ssh: no such identity: ./secret.pem: No such file or directory\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n”, “unreachable”: true}

PLAY RECAP **************************************************************************************************************************************************
redis : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

Dear Team, I have updated host.yaml with current server host and keys. When I ran the command I am getting below error:

<<
ansible-playbook playbook.yaml -t tyk-ce -t redis

PLAY [redis] ************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
fatal: [redis]: FAILED! => {“ansible_facts”: {}, “changed”: false, “failed_modules”: {“setup”: {“ansible_facts”: {“discovered_interpreter_python”: “/usr/bin/python”}, “failed”: true, “module_stderr”: “sudo: sorry, you must have a tty to run sudo\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}}, “msg”: “The following modules failed to execute: setup\n”}

PLAY RECAP **************************************************************************************************************************************************
redis : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Can you Please suggest and Please do confirm that removal of mongo db wont impact api gateway functionality.

Hi,

I can confirm that mongo is only used by tyk-pro and tyk-pump. Without those you don’t need it.

Cheers,
Pete