Add task to check if node service already exists

This commit is contained in:
Rshad Zhran 2019-11-21 14:48:54 +01:00
parent e2cee2e45d
commit 686c02b3d5

View File

@ -1,4 +1,8 @@
--- ---
- name: Check if NodeJS service Exists
stat: path=/usr/bin/node
register: node_service_status
- name: Centos | Get Nodejs - name: Centos | Get Nodejs
shell: | shell: |
set -o pipefail set -o pipefail
@ -8,7 +12,7 @@
executable: /bin/bash executable: /bin/bash
creates: /etc/yum.repos.d/nodesource-el7.repo creates: /etc/yum.repos.d/nodesource-el7.repo
when: when:
- ansible_distribution_major_version|int > 5 - ansible_distribution_major_version|int > 5 and not node_service_status.stat.exists
- name: AmazonLinux/Fedora| Get Nodejs - name: AmazonLinux/Fedora| Get Nodejs
shell: | shell: |
@ -18,7 +22,7 @@
warn: false warn: false
executable: /bin/bash executable: /bin/bash
when: when:
- ansible_distribution|lower == "amazon" or ansible_distribution|lower == 'fedora' - ( ansible_distribution|lower == "amazon" or ansible_distribution|lower == 'fedora' ) and not node_service_status.stat.exists
- name: CentOS/RedHat/Amazon/Fedora | Install NodeJS - name: CentOS/RedHat/Amazon/Fedora | Install NodeJS
package: package:
@ -28,6 +32,7 @@
until: nodejs_is_installed is succeeded until: nodejs_is_installed is succeeded
tags: tags:
- init - init
when: not node_service_status.stat.exists
- name: RedHat/CentOS 5 | Install Wazuh repo - name: RedHat/CentOS 5 | Install Wazuh repo
yum_repository: yum_repository: