diff --git a/handlers/main.yml b/handlers/main.yml index 7f763f42703358ff980093f674e0c171d8520c64..2cc07a2d0aa61f4f8dd999624b5545759a643f6a 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ --- # file: roles/nodejs/handlers/main.yml -- name: "nodeJS | Include forever apps to Boot-List" +- name: nodeJS | Include forever apps to Boot-List command: update-rc.d {{ item.service }} defaults with_items: '{{ nodejs_forever_apps }}' diff --git a/tasks/main.yml b/tasks/main.yml index 981205dc854196271e87ea41991c5cb12918907f..5f0355c188cc05b1de4ef11166c1173dc746751e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,13 +1,15 @@ --- # file: roles/nodejs/tasks/main.yml -- name: "NodeJS Role" - set_fact: role_nodejs_started=true - tags: 'always' +- name: NodeJS Role + set_fact: + role_nodejs_started: yes + tags: + - always - block: - - name: "nodeJS | Install required packages" + - name: nodeJS | Install required packages apt: pkg={{ packages }} state=present @@ -17,18 +19,18 @@ - python-software-properties when: ansible_distribution_release != 'bionic' - - name: "nodeJS | Add key" + - name: nodeJS | Add key apt_key: url="https://deb.nodesource.com/gpgkey/nodesource.gpg.key" state=present - - name: "nodeJS | Add repository" + - name: nodeJS | Add repository apt_repository: repo="deb https://deb.nodesource.com/node_8.x {{ ansible_distribution_release }} main" state=present mode='644' - - name: "nodeJS | Install core packages" + - name: nodeJS | Install core packages apt: pkg={{ packages }} state=present @@ -37,7 +39,7 @@ packages: - nodejs - - name: "nodeJS | Install npm packages" + - name: nodeJS | Install npm packages npm: name={{ item }} state=present @@ -52,7 +54,7 @@ - bower - npm-check-updates - - name: "nodeJS | Ensure log directory" + - name: nodeJS | Ensure log directory file: dest=/var/log/nodejs owner=root @@ -60,7 +62,7 @@ state=directory mode='775' - - name: "nodeJS | Ensure apps directory" + - name: nodeJS | Ensure apps directory file: dest="{{ item.target }}" owner=root @@ -69,7 +71,7 @@ mode='775' with_items: '{{ nodejs_apps }}' - - name: "nodeJS | Install apps" + - name: nodeJS | Install apps git: accept_hostkey: "yes" repo: "{{ item.repository }}" @@ -79,7 +81,7 @@ become: false with_items: '{{ nodejs_apps }}' - - name: "nodeJS | Install apps config files" + - name: nodeJS | Install apps config files copy: src="{{ item.config.src }}" dest="{{ item.config.target }}" @@ -88,12 +90,12 @@ mode='644' with_items: '{{ nodejs_apps }}' - - name: "nodeJS | Install apps packages" + - name: nodeJS | Install apps packages npm: path="{{ item.target }}" with_items: '{{ nodejs_apps }}' - - name: "nodeJS | Install forever apps" + - name: nodeJS | Install forever apps template: src=initd.sh dest=/etc/init.d/{{ item.service }} @@ -104,13 +106,14 @@ notify: - "nodeJS | Include forever apps to Boot-List" - - name: "nodeJS | Enable logrotate" + - name: nodeJS | Enable logrotate template: src=etc_logrotate_d_nodejs dest=/etc/logrotate.d/nodejs owner=root group=root mode='644' - tags: 'logrotate' + tags: + - logrotate - when: '"nodejs" not in excluded_roles' + when: not excluded_roles or "nodejs" not in excluded_roles