<commit_before>---
- name: "Ensure the system can use the HTTPS transport for APT"
  stat:
    path: /usr/lib/apt/methods/https
  register: apt_https_transport

- name: "Install HTTPS transport for APT"
  apt:
    pkg: apt-transport-https
    state: installed
  when: not apt_https_transport.stat.exists

- name: "Import the NodeSource GPG key into apt"
  apt_key:
    url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
    state: present

- name: "Add NodeSource deb repository"
  apt_repository:
    repo: 'deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main'
    state: present

- name: "Add NodeSource deb-src repository"
  apt_repository:
    repo: 'deb-src https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main'
    state: present

- name: "Add NodeSource repository preferences"
  template:
    src: deb_nodesource_com_node.pref.j2
    dest: /etc/apt/preferences.d/deb_nodesource_com_node.pref

- name: "Install Node.js"
  apt:
    name: nodejs
    state: installed
    update_cache: yes

- name: "Upgrade npm to version 5"
  npm:
    name: npm
    global: yes<commit_msg>fixed nodejs installation<commit_after>---
- name: Ensure apt-transport-https is installed.
  apt: name=apt-transport-https state=present

- name: Add Nodesource apt key.
  apt_key:
    url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
    id: "68576280"
    state: present

- name: Add NodeSource repositories for Node.js.
  apt_repository:
    repo: "{{ item }}"
    state: present
  with_items:
    - "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
    - "deb-src https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
  register: node_repo

- name: Update apt cache if repo was added.
  apt: update_cache=yes
  when: node_repo.changed

- name: Ensure Node.js and npm are installed.
  apt: "name=nodejs={{ nodejs_version|regex_replace('x', '') }}* state=present"

- name: "Upgrade npm to version 5"
  npm:
    name: npm
    global: yes
{'fraction_non_alphanumeric': 0.11676786548341897, 'fraction_numerical': 0.011676786548341896, 'mean_word_length': 3.7180616740088106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '810380', 'n_tokens_mistral': 750, 'n_tokens_neox': 708, 'n_words': 183}