Merge pull request #330 from wazuh/feature-326-wazuh-api-installation
Update Wazuh API (NodeJS) installation tasks
This commit is contained in:
commit
dc0b787810
@ -326,3 +326,8 @@ wazuh_agent_configs:
|
||||
format: 'eventchannel'
|
||||
- location: 'System'
|
||||
format: 'eventlog'
|
||||
nodejs:
|
||||
repo_dic:
|
||||
debian: "deb"
|
||||
redhat: "rpm"
|
||||
repo_url_ext: "nodesource.com/setup_8.x"
|
||||
@ -38,32 +38,6 @@
|
||||
update_cache: true
|
||||
changed_when: false
|
||||
|
||||
- name: Debian/Ubuntu | Installing NodeJS repository key (Ubuntu 14)
|
||||
become: true
|
||||
shell: |
|
||||
set -o pipefail
|
||||
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
||||
args:
|
||||
warn: false
|
||||
executable: /bin/bash
|
||||
changed_when: false
|
||||
when:
|
||||
- ansible_distribution == "Ubuntu"
|
||||
- ansible_distribution_major_version | int == 14
|
||||
|
||||
- name: Debian/Ubuntu | Installing NodeJS repository key
|
||||
apt_key:
|
||||
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
|
||||
when:
|
||||
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14)
|
||||
|
||||
- name: Debian/Ubuntu | Add NodeSource repositories for Node.js
|
||||
apt_repository:
|
||||
repo: "deb https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
update_cache: true
|
||||
changed_when: false
|
||||
|
||||
- name: Debian/Ubuntu | Set Distribution CIS filename for Debian/Ubuntu
|
||||
set_fact:
|
||||
cis_distribution_filename: cis_debian_linux_rcl.txt
|
||||
|
||||
@ -1,35 +1,4 @@
|
||||
---
|
||||
- name: RedHat/CentOS | Install Nodejs repo
|
||||
yum_repository:
|
||||
name: NodeJS
|
||||
description: NodeJS-$releasever
|
||||
baseurl: https://rpm.nodesource.com/pub_6.x/el/{{ ansible_distribution_major_version }}/x86_64
|
||||
gpgkey: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
|
||||
gpgcheck: true
|
||||
changed_when: false
|
||||
when:
|
||||
- ansible_distribution_major_version|int > 5
|
||||
|
||||
- name: Fedora | Install Nodejs repo
|
||||
yum_repository:
|
||||
name: NodeJS
|
||||
description: NodeJS-$releasever
|
||||
baseurl: https://rpm.nodesource.com/pub_6.x/fc/$releasever/x86_64
|
||||
gpgkey: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
|
||||
gpgcheck: true
|
||||
when: ansible_distribution == 'Fedora'
|
||||
|
||||
- name: AmazonLinux | 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|lower == "amazon"
|
||||
|
||||
- name: RedHat/CentOS 5 | Install Wazuh repo
|
||||
yum_repository:
|
||||
name: wazuh_repo
|
||||
|
||||
@ -7,6 +7,34 @@
|
||||
- tar
|
||||
state: present
|
||||
|
||||
- name: Check if NodeJS service exists
|
||||
stat:
|
||||
path: /usr/bin/node
|
||||
register: node_service_status
|
||||
|
||||
- name: Install NodeJS repository
|
||||
block:
|
||||
- name: Download NodeJS repository script
|
||||
get_url:
|
||||
url: "https://{{ nodejs['repo_dic'][ansible_os_family|lower] }}.{{ nodejs['repo_url_ext'] }}"
|
||||
dest: /etc/nodejs.sh
|
||||
mode: '0775'
|
||||
changed_when: false
|
||||
|
||||
- name: Run NodeJS bash script
|
||||
command: sh /etc/nodejs.sh
|
||||
register: nodejs_script
|
||||
changed_when: nodejs_script.rc == 0
|
||||
when: not node_service_status.stat.exists
|
||||
|
||||
- name: Installing NodeJS
|
||||
package:
|
||||
name: nodejs
|
||||
state: present
|
||||
register: nodejs_service_is_installed
|
||||
until: nodejs_service_is_installed is succeeded
|
||||
tags: init
|
||||
|
||||
- include_tasks: "RedHat.yml"
|
||||
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int > 5) or (ansible_os_family == "RedHat" and ansible_distribution == "Amazon")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user