- name: Install cloud9 dependencies
  apt:
    name: "{{ item }}"
    state: "present"
  with_items:
    - build-essential
    - python
    - nodejs-legacy

- name: Clone c9/core repository
  git:
    repo: git://github.com/c9/core.git
    dest: /opt/c9sdk

- name: Install c9/core
  shell: |-
    cd /opt/c9sdk
    scripts/install-sdk.sh

- name: Create cloud9 startup script
  copy:
    content: |-
      #!/bin/bash
      cd /opt/c9sdk
      node server.js $@
    dest: /usr/local/bin/cloud9
    owner: root
    group: root
    mode: 0755



- name: Install cloud9 dependencies
  apt:
    name: "{{ item.name }}"
    state: "present"
  when: "{{ item.when }}"
  with_items:
    - {name: "build-essential", when: true}
    - {name: "python", when: true}
    - {name: "nodejs-legacy", when: ansible_distribution != "Ubuntu" or ansible_distribution_version < 17}
    - {name: "nodejs", when: ansible_distribution == "Ubuntu" and ansible_distribution_version > 17}

- name: Clone c9/core repository
  git:
    repo: git://github.com/c9/core.git
    dest: /opt/c9sdk

- name: Install c9/core
  shell: |-
    cd /opt/c9sdk
    scripts/install-sdk.sh

- name: Create cloud9 startup script
  copy:
    content: |-
      #!/bin/bash
      cd /opt/c9sdk
      node server.js $@
    dest: /usr/local/bin/cloud9
    owner: root
    group: root
    mode: 0755



Use nodejs package instead of nodejs-legacy on Ubuntu 17+
fix(cloud9): Use nodejs package instead of nodejs-legacy on Ubuntu 17+
