Ansible, npm and the -save-dev flag

I am trying to use the karma for jenkins available to provide testing servers using the karma-phantomjs-launcher plugin. I hope to avoid using shellscripts of the format "exec npm install".

The problem is that the phantomjs plugin requires a flag --save-devthat will be used during installation. I am looking to use a flag --save-devfrom npm, but the nsnnnnnnnnnnb module has no way to pass these flags to the actual npm command that it runs.

Is this possible, or am I just resorting to using the control module to run npm install karma-phantomjs-launcher --save-dev?

+4
source share
1 answer

, , , npm . , npm , , npm. , npm config save-dev .

, apache npm ( npm bower).

(, , , yum , , npm).

- name: Setup NPM HTTP Proxy
  become: True
  command: npm config set proxy "{{http_proxy}}"
  when: (http_proxy is defined) and (not http_proxy == '') and (node_modules.stat.exists == False)

- name: Clear NPM HTTP Proxy Setting
  become: True
  command: npm config rm proxy
  when: (http_proxy is defined) and (http_proxy == '') and (node_modules.stat.exists == False)

- name: Setup NPM HTTPS Proxy
  become: True
  command: npm config set https-proxy "{{https_proxy}}"
  when: (https_proxy is defined) and (not https_proxy == '') and (node_modules.stat.exists == False)

- name: Clear NPM HTTPS Proxy Setting
  become: True
  command: npm config rm https-proxy
  when: (https_proxy is defined) and (https_proxy == '') and (node_modules.stat.exists == False)

- name: Disable NPM strict SSL mode
  become: True
  command: npm config set strict-ssl false
  when: (http_proxy is defined) and (not http_proxy == '') and (node_modules.stat.exists == False)

- name: Clear NPM strict SSL mode Setting (if no http_proxy)
  become: True
  command: npm config rm strict-ssl
  when: (http_proxy is defined) and (http_proxy == '') and (node_modules.stat.exists == False)

- name: Setup NPM to use http:// version of the registry
  become: True
  command: npm config set registry "http://registry.npmjs.org/"
  when: (http_proxy is defined) and (not http_proxy == '') and (node_modules.stat.exists == False)

- name: Install Bower
  become: True
  shell: >
         umask 022; npm install bower chdir=/usr/local/lib
  when: node_modules.stat.exists == False

,

0

Source: https://habr.com/ru/post/1536515/


All Articles