Centralize NodeJS installation tasks
This commit is contained in:
parent
686c02b3d5
commit
d85d210a3e
@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
- hosts: <WAZUH_MANAGER_HOST>
|
- hosts: <WAZUH_MANAGER_HOST>
|
||||||
|
- vars:
|
||||||
|
- repo_dic:
|
||||||
|
debian: "deb"
|
||||||
|
redhat: "rpm"
|
||||||
roles:
|
roles:
|
||||||
- role: ../roles/wazuh/ansible-wazuh-manager
|
- role: ../roles/wazuh/ansible-wazuh-manager
|
||||||
- role: ../roles/wazuh/ansible-filebeat
|
- role: ../roles/wazuh/ansible-filebeat
|
||||||
|
|||||||
@ -38,24 +38,6 @@
|
|||||||
update_cache: true
|
update_cache: true
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Debian/Ubuntu | Installing NodeJS repository
|
|
||||||
become: true
|
|
||||||
shell: |
|
|
||||||
set -o pipefail
|
|
||||||
curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
|
||||||
args:
|
|
||||||
warn: false
|
|
||||||
executable: /bin/bash
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Debian/Ubuntu | Install NodeJS
|
|
||||||
apt:
|
|
||||||
name: "nodejs"
|
|
||||||
state: present
|
|
||||||
register: nodejs_package_is_installed
|
|
||||||
until: nodejs_package_is_installed is succeeded
|
|
||||||
tags: init
|
|
||||||
|
|
||||||
- name: Debian/Ubuntu | Set Distribution CIS filename for Debian/Ubuntu
|
- name: Debian/Ubuntu | Set Distribution CIS filename for Debian/Ubuntu
|
||||||
set_fact:
|
set_fact:
|
||||||
cis_distribution_filename: cis_debian_linux_rcl.txt
|
cis_distribution_filename: cis_debian_linux_rcl.txt
|
||||||
|
|||||||
@ -1,39 +1,4 @@
|
|||||||
---
|
---
|
||||||
- name: Check if NodeJS service Exists
|
|
||||||
stat: path=/usr/bin/node
|
|
||||||
register: node_service_status
|
|
||||||
|
|
||||||
- name: Centos | Get Nodejs
|
|
||||||
shell: |
|
|
||||||
set -o pipefail
|
|
||||||
curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
|
|
||||||
args:
|
|
||||||
warn: false
|
|
||||||
executable: /bin/bash
|
|
||||||
creates: /etc/yum.repos.d/nodesource-el7.repo
|
|
||||||
when:
|
|
||||||
- ansible_distribution_major_version|int > 5 and not node_service_status.stat.exists
|
|
||||||
|
|
||||||
- name: AmazonLinux/Fedora| Get Nodejs
|
|
||||||
shell: |
|
|
||||||
set -o pipefail
|
|
||||||
curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
|
|
||||||
args:
|
|
||||||
warn: false
|
|
||||||
executable: /bin/bash
|
|
||||||
when:
|
|
||||||
- ( ansible_distribution|lower == "amazon" or ansible_distribution|lower == 'fedora' ) and not node_service_status.stat.exists
|
|
||||||
|
|
||||||
- name: CentOS/RedHat/Amazon/Fedora | Install NodeJS
|
|
||||||
package:
|
|
||||||
name: "nodejs"
|
|
||||||
state: present
|
|
||||||
register: nodejs_is_installed
|
|
||||||
until: nodejs_is_installed is succeeded
|
|
||||||
tags:
|
|
||||||
- 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:
|
||||||
name: wazuh_repo
|
name: wazuh_repo
|
||||||
|
|||||||
@ -13,6 +13,25 @@
|
|||||||
- include_tasks: "Debian.yml"
|
- include_tasks: "Debian.yml"
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: Installing NodeJS repository script
|
||||||
|
become: true
|
||||||
|
get_url:
|
||||||
|
url: "https://{{ repo_dic[ansible_os_family] }}nodesource.com/setup_8.x"
|
||||||
|
dest: /etc/nodejs.sh
|
||||||
|
mode: '0775'
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Running NodeJS bash script
|
||||||
|
script: /etc/nodejs.sh
|
||||||
|
|
||||||
|
- name: Installing NodeJS
|
||||||
|
package:
|
||||||
|
name: ntpdate
|
||||||
|
state: present
|
||||||
|
register: nodejs_service_is_installed
|
||||||
|
until: nodejs_service_is_installed is succeeded
|
||||||
|
tags: init
|
||||||
|
|
||||||
- name: Install expect
|
- name: Install expect
|
||||||
package:
|
package:
|
||||||
name: expect
|
name: expect
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user