From 297f0d4bc54a295e8ad84982e08ad64850d917d1 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Tue, 3 Jul 2018 12:58:52 +0530 Subject: [PATCH] modified mode install method --- .travis.yml | 2 -- playbooks/roles/nodejs/defaults/main.yml | 3 +++ playbooks/roles/nodejs/tasks/debian_family.yml | 14 +------------- playbooks/roles/nodejs/tasks/main.yml | 6 ++++++ playbooks/roles/nodejs/tasks/redhat_family.yml | 15 +-------------- playbooks/site.yml | 2 +- 6 files changed, 12 insertions(+), 30 deletions(-) create mode 100644 playbooks/roles/nodejs/defaults/main.yml diff --git a/.travis.yml b/.travis.yml index e4b562b7..ae45db62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: python dist: trusty -group: deprecated-2017Q2 -sudo: required python: - "2.7" diff --git a/playbooks/roles/nodejs/defaults/main.yml b/playbooks/roles/nodejs/defaults/main.yml new file mode 100644 index 00000000..f991faa1 --- /dev/null +++ b/playbooks/roles/nodejs/defaults/main.yml @@ -0,0 +1,3 @@ +--- +node_version: 8 +... \ No newline at end of file diff --git a/playbooks/roles/nodejs/tasks/debian_family.yml b/playbooks/roles/nodejs/tasks/debian_family.yml index c64bac55..a9930529 100644 --- a/playbooks/roles/nodejs/tasks/debian_family.yml +++ b/playbooks/roles/nodejs/tasks/debian_family.yml @@ -1,17 +1,5 @@ --- -- name: Add apt key for node repo - apt_key: - url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 - id: "68576280" - state: present - -- name: Add repo - apt_repository: - repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_8.x {{ ansible_distribution_release }} main" - state: present - register: node_repo - -- name: Install nodejs 8.x +- name: Install nodejs {{ node_version }} apt: name: nodejs state: present diff --git a/playbooks/roles/nodejs/tasks/main.yml b/playbooks/roles/nodejs/tasks/main.yml index 85379727..6ff013d7 100644 --- a/playbooks/roles/nodejs/tasks/main.yml +++ b/playbooks/roles/nodejs/tasks/main.yml @@ -1,6 +1,12 @@ --- # Install's prerequisites, like fonts, image libraries, vim, screen, python-dev and gcc +- name: 'Add Node.js PPA' + tags: 'nodejs' + become: 'yes' + become_method: 'sudo' + shell: "curl --silent --location https://deb.nodesource.com/setup_{{ node_version }}.x | bash -" + - include_tasks: debian_family.yml when: ansible_os_family == 'Debian' diff --git a/playbooks/roles/nodejs/tasks/redhat_family.yml b/playbooks/roles/nodejs/tasks/redhat_family.yml index 15af3846..1c3d8fb1 100644 --- a/playbooks/roles/nodejs/tasks/redhat_family.yml +++ b/playbooks/roles/nodejs/tasks/redhat_family.yml @@ -1,18 +1,5 @@ --- -- name: Import Node source RPM key - rpm_key: - key: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL - state: present - when: ansible_os_family == 'RedHat' - -- name: Add Node Repo for RedHat - yum: - name: 'https://rpm.nodesource.com/pub_8.x/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm' - state: present - update_cache: yes - when: ansible_os_family == 'RedHat' - -- name: Install node v8 +- name: Install node v{{ node_version }} yum: name=nodejs state=present when: ansible_os_family == 'RedHat' ... \ No newline at end of file diff --git a/playbooks/site.yml b/playbooks/site.yml index 839620ee..ca7cb51a 100644 --- a/playbooks/site.yml +++ b/playbooks/site.yml @@ -7,6 +7,7 @@ roles: - { role: common, tags: common } - { role: locale, tags: locale } + - { role: nodejs, tags: nodejs } - { role: swap, tags: swap, when: production } - { role: logwatch, tags: logwatch, when: production } - { role: bash_screen_wall, tags: bash_screen_wall, when: production } @@ -15,7 +16,6 @@ - { role: ntpd, tags: ntpd, when: production } - { role: mariadb, tags: mariadb } - { role: wkhtmltopdf, tags: wkhtmltopdf } - - { role: nodejs, tags: nodejs } - { role: psutil, tags: psutil } - { role: redis, tags: redis } - { role: supervisor, tags: supervisor, when: production }