Adding hash_behaviour: merge in order not to override the default variables

This commit is contained in:
Rshad Zhran 2019-08-22 16:26:07 +02:00
parent 675e2c5c88
commit e1b084c1a7
8 changed files with 49 additions and 23 deletions

10
Pipfile
View File

@ -14,11 +14,11 @@ molecule = "==2.20.2"
python_version = "2.7" python_version = "2.7"
[scripts] [scripts]
test ="molecule test --destroy=never --platform _PLATFORM_" test ="molecule test --destroy=never"
worker ="molecule test -s worker --destroy=never --platform _PLATFORM_" worker ="molecule test -s worker --destroy=never"
agent ="molecule test -s wazuh-agent --destroy=never --platform _PLATFORM_" agent ="molecule test -s wazuh-agent --destroy=never"
elasticsearch ="molecule test -s elasticsearch --destroy=never --platform _PLATFORM_" elasticsearch ="molecule test -s elasticsearch --destroy=never"
kibana ="molecule test -s kibana --destroy=never --platform _PLATFORM_" kibana ="molecule test -s kibana --destroy=never"
# Destroy all the existing containers ' Molecule instances ' # Destroy all the existing containers ' Molecule instances '
destroy_elasticsearch ="molecule destroy -s elasticsearch" destroy_elasticsearch ="molecule destroy -s elasticsearch"

View File

@ -14,13 +14,13 @@ molecule = "==2.20.2"
python_version = "2.7" python_version = "2.7"
[scripts] [scripts]
test ="molecule test --destroy=never" test ="molecule test --destroy=never --platform _PLATFORM_"
worker ="molecule test -s worker --destroy=never" worker ="molecule test -s worker --destroy=never --platform _PLATFORM_"
agent ="molecule test -s wazuh-agent --destroy=never" agent ="molecule test -s wazuh-agent --destroy=never --platform _PLATFORM_"
elasticsearch ="molecule test -s elasticsearch --destroy=never" elasticsearch ="molecule test -s elasticsearch --destroy=never --platform _PLATFORM_"
kibana ="molecule test -s kibana --destroy=never" kibana ="molecule test -s kibana --destroy=never --platform _PLATFORM_"
# Destroy all the existing containers ' Created by Molecule ' # Destroy all the existing containers ' Molecule instances '
destroy_elasticsearch ="molecule destroy -s elasticsearch" destroy_elasticsearch ="molecule destroy -s elasticsearch"
destroy_worker ="molecule destroy -s worker" destroy_worker ="molecule destroy -s worker"
destroy ="molecule destroy" destroy ="molecule destroy"

View File

@ -2,8 +2,5 @@
- name: Converge - name: Converge
hosts: all hosts: all
roles: roles:
- { role: wazuh/ansible-wazuh-manager, - { role: wazuh/ansible-wazuh-manager, wazuh_manager_config.cluster.disable: 'no' }
wazuh_manager_config[cluster][disable]: 'no',
}
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch:9200' } - { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch:9200' }

View File

@ -9,7 +9,7 @@ lint:
config-data: config-data:
ignore: .virtualenv ignore: .virtualenv
platforms: platforms:
- name: bionic - name: kibana
image: solita/ubuntu-systemd:bionic image: solita/ubuntu-systemd:bionic
command: /sbin/init command: /sbin/init
ulimits: ulimits:

View File

@ -44,6 +44,9 @@ platforms:
# - nofile:262144:262144 # - nofile:262144:262144
provisioner: provisioner:
name: ansible name: ansible
config_options:
defaults:
hash_behaviour: merge
playbooks: playbooks:
docker: docker:
create: ../default/create.yml create: ../default/create.yml

View File

@ -2,10 +2,18 @@
- name: Converge - name: Converge
hosts: all hosts: all
roles: roles:
- { role: wazuh/ansible-wazuh-manager, - role: wazuh/ansible-wazuh-manager
wazuh_manager_config.cluster.disable: 'no', vars:
wazuh_manager_config.cluster.name: 'worker-01', wazuh_manager_config:
wazuh_manager_config.cluster.node_type: 'worker' cluster:
} disable: 'no'
- { role: wazuh/ansible-filebeat, filebeat_output_elasticsearch_hosts: 'elasticsearch:9200' } name: 'wazuh'
node_name: 'worker-01'
node_type: 'worker'
key: 'ugdtAnd7Pi9myP7CVts4qZaZQEQcRYZa'
port: '1516'
bind_addr: '0.0.0.0'
nodes:
- 'manager'
hidden: 'no'

View File

@ -1,4 +1,11 @@
--- ---
- debug:
msg: Cluster is disabled? => {{ wazuh_manager_config.cluster.disable }}
- debug:
#msg: Cluster is disabled? => {{ wazuh_manager_config.cluster.disable }}
msg: .... => {{ wazuh_manager_config.openscap.disable | default('default_value') }}
- import_tasks: "RedHat.yml" - import_tasks: "RedHat.yml"
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int > 5) or (ansible_os_family == "RedHat" and ansible_distribution == "Amazon") when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int > 5) or (ansible_os_family == "RedHat" and ansible_distribution == "Amazon")

View File

@ -1,6 +1,17 @@
#!/bin/bash #!/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 elasticsearch
sudo pipenv run test sudo pipenv run test
sudo pipenv run agent sudo pipenv run agent
sudo pipenv run kibana sudo pipenv run kibana
cp Pipfile.template Pipfile