mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Added draft for CSP health checker
This commit is contained in:
35
roles/npm/README.md
Normal file
35
roles/npm/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# npm
|
||||
|
||||
## Description
|
||||
|
||||
This Ansible role installs npm and optionally runs `npm ci` within a given project directory. It is intended to streamline dependency installation for Node.js applications.
|
||||
|
||||
## Overview
|
||||
|
||||
Designed for use in Node-based projects, this role installs npm and can execute a clean install (`npm ci`) to ensure consistent dependency trees.
|
||||
|
||||
## Features
|
||||
|
||||
- **npm Installation:** Ensures the `npm` package manager is installed.
|
||||
- **Optional Project Setup:** Runs `npm ci` in a specified folder to install exact versions from `package-lock.json`.
|
||||
- **Idempotent:** Skips `npm ci` if no folder is configured.
|
||||
|
||||
## Configuration
|
||||
|
||||
Set `npm_project_folder` to a directory containing `package.json` and `package-lock.json`:
|
||||
|
||||
```yaml
|
||||
vars:
|
||||
npm_project_folder: /opt/scripts/my-node-project/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
CyMaIS NonCommercial License (CNCL)
|
||||
[https://s.veen.world/cncl](https://s.veen.world/cncl)
|
||||
|
||||
## Author
|
||||
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
[https://www.veen.world](https://www.veen.world)
|
24
roles/npm/meta/main.yml
Normal file
24
roles/npm/meta/main.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Installs npm and runs optional 'npm ci' inside a project"
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions: [all]
|
||||
- name: Debian
|
||||
versions: [all]
|
||||
galaxy_tags:
|
||||
- npm
|
||||
- nodejs
|
||||
- automation
|
||||
- javascript
|
||||
repository: "https://s.veen.world/cymais"
|
||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
dependencies: []
|
12
roles/npm/tasks/main.yml
Normal file
12
roles/npm/tasks/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
- name: Ensure npm is installed
|
||||
package:
|
||||
name: npm
|
||||
state: present
|
||||
|
||||
- name: Run 'npm ci' in {{ npm_project_folder }}
|
||||
command: npm ci
|
||||
args:
|
||||
chdir: "{{ npm_project_folder }}"
|
||||
when: npm_project_folder is defined
|
||||
register: npm_output
|
||||
changed_when: "'added' in npm_output.stdout or 'updated' in npm_output.stdout"
|
2
roles/npm/vars/main.yml
Normal file
2
roles/npm/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
# Optional project folder to run 'npm ci' in
|
||||
npm_project_folder: null
|
Reference in New Issue
Block a user