I'm trying a to test if ansible is able to run the pm2 module on my local machine.
I installed pm2 for ansible by using:
sudo -H pip install ansible-modules-pm2
And this what my playbook looks like:
---
- hosts: localhost
connection: local
become: true
tasks:
- name: Install pm2 package using npm
npm:
name: pm2
global: yes
- name: Start server.js
pm2:
name: server
script: /home/majeed/host_share/server.js
state: started
When I run the playbook, I get the error:
fatal: [localhost]: FAILED! => {"msg": "Could not find imported module support code for pm2. Looked for either pm2.py or module_utils.py"}
I've checked if pm2 has been installed using:
npm list -g | grep pm2
And it has been installed, there is no issue. pip has also installed ansible-modules-pm2 successfully.
What is causing my playbook to fail ?