{"id":20511569,"url":"https://github.com/10sr/ansible-modules-pm2","last_synced_at":"2025-07-26T16:08:48.278Z","repository":{"id":57410528,"uuid":"245931375","full_name":"10sr/ansible-modules-pm2","owner":"10sr","description":"Ansible Module to Manage Processes via PM2","archived":false,"fork":false,"pushed_at":"2020-09-22T22:59:05.000Z","size":210,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-04T21:05:47.698Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/ansible-modules-pm2/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/10sr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-09T03:00:46.000Z","updated_at":"2024-12-04T12:52:03.000Z","dependencies_parsed_at":"2022-08-27T22:01:06.017Z","dependency_job_id":null,"html_url":"https://github.com/10sr/ansible-modules-pm2","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/10sr/ansible-modules-pm2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10sr%2Fansible-modules-pm2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10sr%2Fansible-modules-pm2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10sr%2Fansible-modules-pm2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10sr%2Fansible-modules-pm2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/10sr","download_url":"https://codeload.github.com/10sr/ansible-modules-pm2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10sr%2Fansible-modules-pm2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267191040,"owners_count":24050318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T20:36:25.156Z","updated_at":"2025-07-26T16:08:48.258Z","avatar_url":"https://github.com/10sr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Github Actions](https://github.com/10sr/ansible-modules-pm2/workflows/Build/badge.svg?event=push)](https://github.com/10sr/ansible-modules-pm2/actions)\n[![PyPI version](https://badge.fury.io/py/ansible-modules-pm2.svg)](https://badge.fury.io/py/ansible-modules-pm2)\n[![Downloads](https://pepy.tech/badge/ansible-modules-pm2)](https://pepy.tech/project/ansible-modules-pm2)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\n\nansible-modules-pm2\n===================\n\nAnsible Module to Manage Processes via [PM2](https://pm2.keymetrics.io/)\n\n- Manage the state of processes via pm2 process manager\n- Start/Stop/Restart/Reload/Delete applications\n\n\n\nTested on:\n\n- Host Python: 3.8\n- Target host Python: 2.7, 3.5, 3.6, 3.7, 3.8\n- Ansible: 2.8.10, 2.9.6 (Should work with older versions)\n\n\nInstallation\n------------\n\nInstall via pip:\n\n```shell\n# Have to be installed in the same environment as ansible.\n# For details please see the Troubleshooting section below.\npip install ansible-modules-pm2\n```\n\n\nPM2 package have to be installed to target hosts.\nFor example, add following to your playbook to install pm2 globally:\n\n\n```yaml\n- npm:\n    name: pm2\n    global: yes\n```\n\n\n\nUsage\n=====\n\nBasic usage is similar to `service` or `supervisorctl` module:\nspecify the name and its state. To start an app, give either `script`\nor `config`.\n\n\nExamples\n--------\n\n\n```yaml\n---\n- name: Start myapp with process config file, if not running\n  pm2:\n    name: myapp\n    config: /path/to/myapp/myapp.json\n    state: started\n\n- name: Start myapp.js, if not running\n  pm2:\n    name: myapp\n    script: /path/to/myapp/myapp.js\n    state: started\n\n- name: Stop process named myapp, if running\n  pm2:\n    name: myapp\n    state: stopped\n\n- name: Restart myapp, in all cases\n  pm2:\n    name: myapp\n    state: restarted\n\n- name: Reload myapp, in all cases\n  pm2:\n    name: myapp\n    state: reloaded\n\n- name: Delete myapp, if exists\n  pm2:\n    name: myapp\n    state: absent\n\n- name: Specify pm2 executable path\n  pm2:\n    name: myapp\n    state: started\n    config: /path/to/myapp/myapp.json\n    executable: /path/to/myapp/node_modules/.bin/pm2\n\n- name: Also specify working directory where running pm2 command\n  pm2:\n    name: myapp\n    state: started\n    config: /path/to/myapp/myapp.json\n    executable: /path/to/myapp/node_modules/.bin/pm2\n    chdir: /path/to/working/directory\n```\n\n\nArguments\n---------\n\n| Parameters      | Choices                                                                                | Comments                                                                                                                                                                                                                                                                                                  |\n|-----------------|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| name (required) |                                                                                        | Name of the application.\u003cbr\u003eRequired for all cases to check current status of app                                                                                                                                                                                                                         |\n| state           | `started` (default)\u003cbr\u003e`stopped`\u003cbr\u003e`restarted`\u003cbr\u003e`reloaded`\u003cbr\u003e`absent`\u003cbr\u003e`deleted` | `started`/`stopped`/`absent`/`deleted` are idempotent actions that will not run commands unless necessary.\u003cbr\u003e`restarted` will always restart the process.\u003cbr\u003e`reloaded` will always reload.\u003cbr\u003eNote that `restarted` will fail when the process does not exist (action does not start it automatically). |\n| config          |                                                                                        | Process configuration file, in JSON or YAML format.\u003cbr\u003eEither `config` or `script` is required when `state=started`.                                                                                                                                                                                      |\n| script          |                                                                                        | Executalbe file to start.\u003cbr\u003eEither `config` or `script` is required when `state=started`.                                                                                                                                                                                                                |\n| executable      |                                                                                        | Path to pm2 executable.                                                                                                                                                                                                                                                                                   |\n| chdir           |                                                                                        | Change into this directory before running pm2 start command.\u003cbr\u003eWhen `state=started` and this option is omitted, use the directory where `config` or `script` exists.                                                                                                                                     |\n\n\nTroubleshooting\n===============\n\n\nERROR! couldn't resolve module/action 'pm2'\n-------------------------------------------\n\nThis and ansible modules have to be installed in the same environment.\nYou can run the following commands to check where these modules were installed:\n\n```\n$ python  # Start a python interactive shell \nPython 3.7.3 (default, Jun 13 2019, 13:22:19)\n[Clang 9.0.0 (clang-900.0.39.2)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e import ansible\n\u003e\u003e\u003e import ansible.modules.pm2\n\u003e\u003e\u003e ansible.__path__\n['/path/to/your/venv/lib/python3.7/site-packages/ansible']\n\u003e\u003e\u003e ansible.modules.pm2.__path__\n['/path/to/your/venv/lib/python3.7/site-packages/ansible/modules/pm2']\n```\n\n\nLicense\n=======\n\nThis software is licensed under GPLv3. See `LICENSE` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10sr%2Fansible-modules-pm2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F10sr%2Fansible-modules-pm2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10sr%2Fansible-modules-pm2/lists"}