made the platform selection dynamic

This commit is contained in:
Rshad Zhran 2019-08-23 11:28:14 +02:00
parent 726a8962c5
commit ce862efdca
13 changed files with 120 additions and 72 deletions

View File

@ -20,7 +20,16 @@ agent ="molecule test -s wazuh-agent --destroy=never --platform _PLATFORM_"
elasticsearch ="molecule test -s elasticsearch --destroy=never --platform _PLATFORM_"
kibana ="molecule test -s kibana --destroy=never --platform _PLATFORM_"
# Destroy all the existing containers ' Molecule instances '
destroy_elasticsearch ="molecule destroy -s elasticsearch"
destroy_worker ="molecule destroy -s worker"
# Verify ..
verify ="molecule verify"
verify_worker ="molecule verify -s worker"
verify_agent ="molecule verify -s agent"
verify_elasticsearch ="molecule verify -s elasticsearch"
verify_kibana ="molecule verify -s kibana"
# Destroy ..
destroy ="molecule destroy"
destroy_worker ="molecule destroy -s worker"
destroy_agent ="molecule destroy -s agent"
destroy_elasticsearch ="molecule destroy -s elasticsearch"
destroy_kibana ="molecule destroy -s kibana"

View File

@ -7,20 +7,20 @@ lint:
name: yamllint
enabled: false
platforms:
- name: manager
- name: manager_bionic
image: solita/ubuntu-systemd:bionic
command: /sbin/init
ulimits:
- nofile:262144:262144
privileged: true
memory_reservation: 2048m
# - name: xenial
# image: solita/ubuntu-systemd:xenial
# privileged: true
# memory_reservation: 2048m
# command: /sbin/init
# ulimits:
# - nofile:262144:262144
- name: manager_xenial
image: solita/ubuntu-systemd:xenial
privileged: true
memory_reservation: 2048m
command: /sbin/init
ulimits:
- nofile:262144:262144
# - name: trusty
# image: ubuntu:trusty
# privileged: true
@ -33,12 +33,12 @@ platforms:
# memory_reservation: 2048m
# ulimits:
# - nofile:262144:262144
# - name: centos7
# image: milcom/centos7-systemd
# memory_reservation: 2048m
# privileged: true
# ulimits:
# - nofile:262144:262144
- name: manager_centos7
image: milcom/centos7-systemd
memory_reservation: 2048m
privileged: true
ulimits:
- nofile:262144:262144
provisioner:
name: ansible
config_options:

View File

@ -14,6 +14,6 @@
port: '1516'
bind_addr: '0.0.0.0'
nodes:
- 'manager_platofrm'
- 'manager_bionic'
hidden: 'no'
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch_platform:9200' }
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch_bionic:9200' }

View File

@ -0,0 +1,19 @@
---
- name: Converge
hosts: all
roles:
- role: wazuh/ansible-wazuh-manager
vars:
wazuh_manager_config:
cluster:
disable: 'no'
name: 'wazuh'
node_name: 'manager'
node_type: 'master'
key: 'ugdtAnd7Pi9myP7CVts4qZaZQEQcRYZa'
port: '1516'
bind_addr: '0.0.0.0'
nodes:
- 'manager_platform'
hidden: 'no'
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch_platform:9200' }

View File

@ -3,4 +3,4 @@
hosts: all
roles:
- role: elastic-stack/ansible-elasticsearch
elasticsearch_network_host: 'elasticsearch'
elasticsearch_network_host: 'elasticsearch_platform'

View File

@ -9,20 +9,20 @@ lint:
config-data:
ignore: .virtualenv
platforms:
- name: kibana
- name: kibana_bionic
image: solita/ubuntu-systemd:bionic
command: /sbin/init
ulimits:
- nofile:262144:262144
privileged: true
memory_reservation: 1024m
# - name: xenial
# image: solita/ubuntu-systemd:xenial
# privileged: true
# memory_reservation: 1024m
# command: /sbin/init
# ulimits:
# - nofile:262144:262144
- name: kibana_xenial
image: solita/ubuntu-systemd:xenial
privileged: true
memory_reservation: 1024m
command: /sbin/init
ulimits:
- nofile:262144:262144
# - name: trusty
# image: ubuntu:trusty
# memory_reservation: 1024m
@ -34,12 +34,12 @@ platforms:
# memory_reservation: 1024m
# ulimits:
# - nofile:262144:262144
# - name: centos7
# image: milcom/centos7-systemd
# memory_reservation: 1024m
# privileged: true
# ulimits:
# - nofile:262144:262144
- name: kibana_centos7
image: milcom/centos7-systemd
memory_reservation: 1024m
privileged: true
ulimits:
- nofile:262144:262144
provisioner:
name: ansible
config_options:

View File

@ -3,4 +3,4 @@
hosts: all
roles:
- role: elastic-stack/ansible-kibana
elasticsearch_network_host: 'elasticsearch'
elasticsearch_network_host: 'elasticsearch_platform'

View File

@ -5,7 +5,7 @@
- role: wazuh/ansible-wazuh-agent
vars:
wazuh_managers:
- address: 'manager'
- address: 'manager_platform'
port: 1514
protocol: tcp
api_port: 55000

View File

@ -9,22 +9,21 @@ lint:
config-data:
ignore: .virtualenv
platforms:
- name: worker
- name: worker_bionic
image: solita/ubuntu-systemd:bionic
command: /sbin/init
ulimits:
- nofile:262144:262144
privileged: true
memory_reservation: 2048m
#- name: xenial
# image: solita/ubuntu-systemd:xenial
# privileged: true
# memory_reservation: 2048m
# command: /sbin/init
# ulimits:
# - nofile:262144:262144
#- name: trusty
- name: worker_xenial
image: solita/ubuntu-systemd:xenial
privileged: true
memory_reservation: 2048m
command: /sbin/init
ulimits:
- nofile:262144:262144
- name: trusty
#image: ubuntu:trusty
#privileged: true
#memory_reservation: 2048m
@ -36,12 +35,12 @@ platforms:
# memory_reservation: 2048m
# ulimits:
# - nofile:262144:262144
#- name: centos7
# image: milcom/centos7-systemd
# memory_reservation: 2048m
# privileged: true
# ulimits:
# - nofile:262144:262144
- name: worker_centos7
image: milcom/centos7-systemd
memory_reservation: 2048m
privileged: true
ulimits:
- nofile:262144:262144
provisioner:
name: ansible
config_options:

View File

@ -14,8 +14,8 @@
port: '1516'
bind_addr: '0.0.0.0'
nodes:
- 'manager'
- 'manager_bionic'
hidden: 'no'
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch:9200' }
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch_bionic:9200' }

View File

@ -0,0 +1,21 @@
---
- name: Converge
hosts: all
roles:
- role: wazuh/ansible-wazuh-manager
vars:
wazuh_manager_config:
cluster:
disable: 'no'
name: 'wazuh'
node_name: 'worker-01'
node_type: 'worker'
key: 'ugdtAnd7Pi9myP7CVts4qZaZQEQcRYZa'
port: '1516'
bind_addr: '0.0.0.0'
nodes:
- 'manager_platform'
hidden: 'no'
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch_platform:9200' }

View File

@ -1,6 +1,23 @@
#!/bin/bash
paths=( "molecule/default/" "molecule/worker/" "molecule/elasticsearch/" "molecule/kibana/" )
if [ -z "$1" ]
then
echo "Platform not selected. Please select a platform. => Aborting"
exit
else
for i in "${paths[@]}"
do
cp "$i/playbook.yml.template" "$i/playbook.yml"
sed -i "s/platform/$1/g" "$i/playbook.yml"
done
cp Pipfile.template Pipfile
sed -i "s/_PLATFORM_/$1/g" Pipfile
fi
sudo pipenv run elasticsearch
sudo pipenv run test
sudo pipenv run worker
sudo pipenv run agent
sudo pipenv run kibana

View File

@ -1,17 +0,0 @@
#!/bin/bash
if [ -z "$1" ]
then
echo "Platform not selected. Please select a platform. => Aborting"
exit
else
cp Pipfile.template Pipfile
sed -i "s/_PLATFORM_/$1/g" Pipfile
fi
sudo pipenv run elasticsearch
sudo pipenv run test
sudo pipenv run agent
sudo pipenv run kibana
cp Pipfile.template Pipfile