From a48169d53f76794160c32c01efc6292952f1db48 Mon Sep 17 00:00:00 2001 From: rshad Date: Mon, 8 Jul 2019 09:27:01 +0000 Subject: [PATCH 1/8] modified molecule.yml for wazuh-agent and elasticsearch - Lint --- .swp | Bin 0 -> 12288 bytes molecule/elasticsearch/molecule.yml | 7 ++++++- molecule/wazuh-agent/molecule.yml | 6 +++++- roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .swp diff --git a/.swp b/.swp new file mode 100644 index 0000000000000000000000000000000000000000..3cc197e09a7cc13ae44c3cb176cce131024a3112 GIT binary patch literal 12288 zcmeI%Jqp4w6u|LU!NEz<3sl{u>LP*%aB!@nl9C`oKctO^+g`)lB(ENOSMtO*)<4F?LHd_AkYPYfxliY%d0-0 zP2I`Z??O@3fB*srAbLmC7SKmY**5I_I{1Q0*~ z0R#|eKtO4c_fX`M_u~J*djFU62J&$v0tg_000IagfB*srAbD|Z|jm{a* literal 0 HcmV?d00001 diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml index 9897fe56..6d6e962a 100644 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -3,8 +3,13 @@ dependency: name: galaxy driver: name: docker +#lint: +# name: yamllint lint: name: yamllint + options: + config-data: + ignore: .virtualenv platforms: - name: bionic image: solita/ubuntu-systemd:bionic @@ -48,7 +53,7 @@ provisioner: ANSIBLE_ROLES_PATH: ../../roles lint: name: ansible-lint - enabled: true + enabled: false inventory: group_vars: all: diff --git a/molecule/wazuh-agent/molecule.yml b/molecule/wazuh-agent/molecule.yml index f64bc114..47c0012f 100644 --- a/molecule/wazuh-agent/molecule.yml +++ b/molecule/wazuh-agent/molecule.yml @@ -3,8 +3,13 @@ dependency: name: galaxy driver: name: docker + #lint: + # name: yamllint lint: name: yamllint + options: + config-data: + ignore: .virtualenv platforms: - name: wazuh_server_centos7 image: milcom/centos7-systemd @@ -72,7 +77,6 @@ provisioner: ssl_agent_cert: null ssl_agent_key: null ssl_auto_negotiate: 'no' - lint: name: ansible-lint enabled: true diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml index 76721362..2b644bde 100644 --- a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml @@ -8,7 +8,7 @@ - name: Linux | Install wazuh-agent package: name=wazuh-agent state=present async: 90 - poll: 15 + poll: 30 tags: - init From 5d006cbc3a5300fb8c42c9efa4e8eb75f7100ca9 Mon Sep 17 00:00:00 2001 From: rshad Date: Tue, 9 Jul 2019 15:31:38 +0000 Subject: [PATCH 2/8] adapted wazuh-manager installation so it takes into account the package version - Differentiating between CentOS/RedHat and Debian --- .gitignore | 0 .swp | Bin .yamllint | 0 CHANGELOG.md | 0 LICENSE | 0 Pipfile | 0 README.md | 0 VERSION | 0 molecule/default/Dockerfile.j2 | 0 molecule/default/INSTALL.rst | 0 molecule/default/create.yml | 0 molecule/default/destroy.yml | 0 molecule/default/molecule.yml | 0 molecule/default/playbook.yml | 0 molecule/default/prepare.yml | 0 molecule/default/tests/test_default.py | 2 +- molecule/elasticsearch/Dockerfile.j2 | 0 molecule/elasticsearch/INSTALL.rst | 0 molecule/elasticsearch/molecule.yml | 48 +++---- molecule/elasticsearch/playbook.yml | 0 molecule/elasticsearch/tests/test_default.py | 0 .../external_packages/jdk-8u211-linux-x64.rpm | 117 ++++++++++++++++++ molecule/filebeat/Dockerfile.j2 | 0 molecule/filebeat/INSTALL.rst | 0 molecule/filebeat/molecule.yml | 0 molecule/filebeat/playbook.yml | 0 molecule/filebeat/prepare.yml | 0 molecule/filebeat/tests/test_default.py | 0 molecule/kibana/Dockerfile.j2 | 0 molecule/kibana/INSTALL.rst | 0 molecule/kibana/molecule.yml | 0 molecule/kibana/playbook.yml | 0 molecule/kibana/prepare.yml | 0 molecule/kibana/tests/test_default.py | 0 molecule/wazuh-agent/Dockerfile.j2 | 0 molecule/wazuh-agent/INSTALL.rst | 0 molecule/wazuh-agent/molecule.yml | 0 molecule/wazuh-agent/playbook.yml | 0 molecule/wazuh-agent/prepare.yml | 0 molecule/wazuh-agent/tests/test_agents.py | 0 molecule/wazuh-agent/tests/test_manager.py | 0 playbooks/wazuh-agent.yml | 0 playbooks/wazuh-elastic.yml | 0 playbooks/wazuh-elastic_stack-distributed.yml | 0 playbooks/wazuh-elastic_stack-single.yml | 0 playbooks/wazuh-kibana.yml | 0 playbooks/wazuh-manager.yml | 0 roles/ansible-galaxy/meta/main.yml | 0 .../ansible-elasticsearch/README.md | 0 .../ansible-elasticsearch/defaults/main.yml | 0 .../ansible-elasticsearch/handlers/main.yml | 0 .../ansible-elasticsearch/meta/main.yml | 0 .../ansible-elasticsearch/tasks/Debian.yml | 0 .../ansible-elasticsearch/tasks/RMDebian.yml | 0 .../ansible-elasticsearch/tasks/RMRedHat.yml | 0 .../ansible-elasticsearch/tasks/RedHat.yml | 0 .../ansible-elasticsearch/tasks/main.yml | 27 +++- .../templates/elasticsearch.yml.j2 | 0 .../templates/elasticsearch_nonsystemd.j2 | 0 .../templates/elasticsearch_systemd.conf.j2 | 0 .../templates/instances.yml.j2 | 0 .../templates/jvm.options.j2 | 0 .../wazuh-elastic6-template-alerts.json.j2 | 0 .../wazuh-elastic7-template-alerts.json.j2 | 0 roles/elastic-stack/ansible-kibana/README.md | 0 .../ansible-kibana/defaults/main.yml | 0 .../ansible-kibana/handlers/main.yml | 0 .../ansible-kibana/meta/main.yml | 0 .../ansible-kibana/tasks/Debian.yml | 0 .../ansible-kibana/tasks/RMDebian.yml | 0 .../ansible-kibana/tasks/RMRedHat.yml | 0 .../ansible-kibana/tasks/RedHat.yml | 0 .../ansible-kibana/tasks/main.yml | 0 .../ansible-kibana/templates/kibana.yml.j2 | 0 roles/wazuh/ansible-filebeat/README.md | 0 .../wazuh/ansible-filebeat/defaults/main.yml | 0 .../wazuh/ansible-filebeat/handlers/main.yml | 0 roles/wazuh/ansible-filebeat/meta/main.yml | 0 roles/wazuh/ansible-filebeat/tasks/Debian.yml | 0 .../wazuh/ansible-filebeat/tasks/RMDebian.yml | 0 .../wazuh/ansible-filebeat/tasks/RMRedHat.yml | 0 roles/wazuh/ansible-filebeat/tasks/RedHat.yml | 0 roles/wazuh/ansible-filebeat/tasks/config.yml | 0 roles/wazuh/ansible-filebeat/tasks/main.yml | 0 .../templates/elasticsearch.yml.j2 | 0 .../templates/filebeat.yml.j2 | 0 .../ansible-filebeat/tests/requirements.yml | 0 roles/wazuh/ansible-filebeat/tests/test.yml | 0 roles/wazuh/ansible-wazuh-agent/README.md | 0 .../ansible-wazuh-agent/defaults/main.yml | 0 .../ansible-wazuh-agent/handlers/main.yml | 0 roles/wazuh/ansible-wazuh-agent/meta/main.yml | 0 .../ansible-wazuh-agent/tasks/Debian.yml | 0 .../wazuh/ansible-wazuh-agent/tasks/Linux.yml | 0 .../ansible-wazuh-agent/tasks/RMDebian.yml | 0 .../ansible-wazuh-agent/tasks/RMRedHat.yml | 0 .../ansible-wazuh-agent/tasks/RedHat.yml | 0 .../ansible-wazuh-agent/tasks/Windows.yml | 0 .../wazuh/ansible-wazuh-agent/tasks/main.yml | 0 ...r-ossec-etc-local-internal-options.conf.j2 | 0 .../var-ossec-etc-ossec-agent.conf.j2 | 0 .../ansible-wazuh-agent/vars/api_pass.yml | 0 .../ansible-wazuh-agent/vars/authd_pass.yml | 0 roles/wazuh/ansible-wazuh-manager/README.md | 0 .../ansible-wazuh-manager/defaults/main.yml | 2 + .../decoders/sample_custom_decoders.xml | 0 .../rules/sample_custom_rules.xml | 0 .../ansible-wazuh-manager/handlers/main.yml | 0 .../wazuh/ansible-wazuh-manager/meta/main.yml | 0 .../ansible-wazuh-manager/tasks/Debian.yml | 0 .../ansible-wazuh-manager/tasks/RMDebian.yml | 0 .../ansible-wazuh-manager/tasks/RMRedHat.yml | 0 .../ansible-wazuh-manager/tasks/RedHat.yml | 0 .../ansible-wazuh-manager/tasks/main.yml | 29 ++++- .../templates/agentless.j2 | 0 .../templates/api_user.j2 | 0 .../templates/authd_pass.j2 | 0 .../templates/cdb_lists.j2 | 0 .../var-ossec-api-configuration-config.js.j2 | 0 ...r-ossec-etc-local-internal-options.conf.j2 | 0 .../var-ossec-etc-ossec-server.conf.j2 | 0 .../var-ossec-etc-shared-agent.conf.j2 | 0 .../var-ossec-rules-local_decoder.xml.j2 | 0 .../var-ossec-rules-local_rules.xml.j2 | 0 .../vars/agentless_creds.yml | 0 .../ansible-wazuh-manager/vars/authd_pass.yml | 0 .../ansible-wazuh-manager/vars/cdb_lists.yml | 0 .../vars/wazuh_api_creds.yml | 0 128 files changed, 194 insertions(+), 31 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .swp mode change 100644 => 100755 .yamllint mode change 100644 => 100755 CHANGELOG.md mode change 100644 => 100755 LICENSE mode change 100644 => 100755 Pipfile mode change 100644 => 100755 README.md mode change 100644 => 100755 VERSION mode change 100644 => 100755 molecule/default/Dockerfile.j2 mode change 100644 => 100755 molecule/default/INSTALL.rst mode change 100644 => 100755 molecule/default/create.yml mode change 100644 => 100755 molecule/default/destroy.yml mode change 100644 => 100755 molecule/default/molecule.yml mode change 100644 => 100755 molecule/default/playbook.yml mode change 100644 => 100755 molecule/default/prepare.yml mode change 100644 => 100755 molecule/default/tests/test_default.py mode change 100644 => 100755 molecule/elasticsearch/Dockerfile.j2 mode change 100644 => 100755 molecule/elasticsearch/INSTALL.rst mode change 100644 => 100755 molecule/elasticsearch/molecule.yml mode change 100644 => 100755 molecule/elasticsearch/playbook.yml mode change 100644 => 100755 molecule/elasticsearch/tests/test_default.py create mode 100755 molecule/external_packages/jdk-8u211-linux-x64.rpm mode change 100644 => 100755 molecule/filebeat/Dockerfile.j2 mode change 100644 => 100755 molecule/filebeat/INSTALL.rst mode change 100644 => 100755 molecule/filebeat/molecule.yml mode change 100644 => 100755 molecule/filebeat/playbook.yml mode change 100644 => 100755 molecule/filebeat/prepare.yml mode change 100644 => 100755 molecule/filebeat/tests/test_default.py mode change 100644 => 100755 molecule/kibana/Dockerfile.j2 mode change 100644 => 100755 molecule/kibana/INSTALL.rst mode change 100644 => 100755 molecule/kibana/molecule.yml mode change 100644 => 100755 molecule/kibana/playbook.yml mode change 100644 => 100755 molecule/kibana/prepare.yml mode change 100644 => 100755 molecule/kibana/tests/test_default.py mode change 100644 => 100755 molecule/wazuh-agent/Dockerfile.j2 mode change 100644 => 100755 molecule/wazuh-agent/INSTALL.rst mode change 100644 => 100755 molecule/wazuh-agent/molecule.yml mode change 100644 => 100755 molecule/wazuh-agent/playbook.yml mode change 100644 => 100755 molecule/wazuh-agent/prepare.yml mode change 100644 => 100755 molecule/wazuh-agent/tests/test_agents.py mode change 100644 => 100755 molecule/wazuh-agent/tests/test_manager.py mode change 100644 => 100755 playbooks/wazuh-agent.yml mode change 100644 => 100755 playbooks/wazuh-elastic.yml mode change 100644 => 100755 playbooks/wazuh-elastic_stack-distributed.yml mode change 100644 => 100755 playbooks/wazuh-elastic_stack-single.yml mode change 100644 => 100755 playbooks/wazuh-kibana.yml mode change 100644 => 100755 playbooks/wazuh-manager.yml mode change 100644 => 100755 roles/ansible-galaxy/meta/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/README.md mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/defaults/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/handlers/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/meta/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/tasks/RMDebian.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/tasks/RMRedHat.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/tasks/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch_nonsystemd.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch_systemd.conf.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/instances.yml.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/jvm.options.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/wazuh-elastic6-template-alerts.json.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-elasticsearch/templates/wazuh-elastic7-template-alerts.json.j2 mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/README.md mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/defaults/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/handlers/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/meta/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/tasks/Debian.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/tasks/RMDebian.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/tasks/RMRedHat.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/tasks/RedHat.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/tasks/main.yml mode change 100644 => 100755 roles/elastic-stack/ansible-kibana/templates/kibana.yml.j2 mode change 100644 => 100755 roles/wazuh/ansible-filebeat/README.md mode change 100644 => 100755 roles/wazuh/ansible-filebeat/defaults/main.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/handlers/main.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/meta/main.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tasks/Debian.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tasks/RMDebian.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tasks/RMRedHat.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tasks/RedHat.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tasks/config.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tasks/main.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/templates/elasticsearch.yml.j2 mode change 100644 => 100755 roles/wazuh/ansible-filebeat/templates/filebeat.yml.j2 mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tests/requirements.yml mode change 100644 => 100755 roles/wazuh/ansible-filebeat/tests/test.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/README.md mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/defaults/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/handlers/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/meta/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/RMDebian.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/RMRedHat.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/tasks/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-local-internal-options.conf.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/vars/api_pass.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-agent/vars/authd_pass.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/README.md mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/defaults/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/files/custom_ruleset/decoders/sample_custom_decoders.xml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/files/custom_ruleset/rules/sample_custom_rules.xml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/handlers/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/meta/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/tasks/Debian.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/tasks/RMDebian.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/tasks/RMRedHat.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/tasks/RedHat.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/tasks/main.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/agentless.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/api_user.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/authd_pass.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/cdb_lists.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/var-ossec-api-configuration-config.js.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-local-internal-options.conf.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/var-ossec-rules-local_decoder.xml.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/templates/var-ossec-rules-local_rules.xml.j2 mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/vars/agentless_creds.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/vars/authd_pass.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/vars/cdb_lists.yml mode change 100644 => 100755 roles/wazuh/ansible-wazuh-manager/vars/wazuh_api_creds.yml diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.swp b/.swp old mode 100644 new mode 100755 diff --git a/.yamllint b/.yamllint old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Pipfile b/Pipfile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/VERSION b/VERSION old mode 100644 new mode 100755 diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 old mode 100644 new mode 100755 diff --git a/molecule/default/INSTALL.rst b/molecule/default/INSTALL.rst old mode 100644 new mode 100755 diff --git a/molecule/default/create.yml b/molecule/default/create.yml old mode 100644 new mode 100755 diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml old mode 100644 new mode 100755 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml old mode 100644 new mode 100755 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml old mode 100644 new mode 100755 diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml old mode 100644 new mode 100755 diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py old mode 100644 new mode 100755 index 16a32b85..4e6e25d6 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def get_wazuh_version(): """This return the version of Wazuh.""" - return "3.9.2" + return "3.9.0" def test_wazuh_packages_are_installed(host): diff --git a/molecule/elasticsearch/Dockerfile.j2 b/molecule/elasticsearch/Dockerfile.j2 old mode 100644 new mode 100755 diff --git a/molecule/elasticsearch/INSTALL.rst b/molecule/elasticsearch/INSTALL.rst old mode 100644 new mode 100755 diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml old mode 100644 new mode 100755 index 6d6e962a..585614b2 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -11,36 +11,36 @@ lint: config-data: ignore: .virtualenv platforms: - - name: 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: trusty - image: ubuntu:trusty - memory_reservation: 1024m - ulimits: - - nofile:262144:262144 + # - name: 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: trusty + #image: ubuntu:trusty + #memory_reservation: 1024m + #ulimits: + #- nofile:262144:262144 - name: centos6 image: centos:6 privileged: true memory_reservation: 1024m ulimits: - nofile:262144:262144 - - name: centos7 - image: milcom/centos7-systemd - memory_reservation: 1024m - privileged: true - ulimits: + # - name: centos7 + # image: milcom/centos7-systemd + # memory_reservation: 1024m + # privileged: true + # ulimits: - nofile:262144:262144 provisioner: name: ansible diff --git a/molecule/elasticsearch/playbook.yml b/molecule/elasticsearch/playbook.yml old mode 100644 new mode 100755 diff --git a/molecule/elasticsearch/tests/test_default.py b/molecule/elasticsearch/tests/test_default.py old mode 100644 new mode 100755 diff --git a/molecule/external_packages/jdk-8u211-linux-x64.rpm b/molecule/external_packages/jdk-8u211-linux-x64.rpm new file mode 100755 index 00000000..f0fccd61 --- /dev/null +++ b/molecule/external_packages/jdk-8u211-linux-x64.rpm @@ -0,0 +1,117 @@ + + +Unauthorized Request + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Sorry!

In order to download products from Oracle Technology + Network you must agree to the OTN license terms.
Be sure that...
+ Your browser has "cookies" and JavaScript enabled.
+ You clicked on "Accept License" for the product you wish to download.
+ You attempt the download within 30 minutes of accepting the license.
From here you can go...
+ + + + + + + + + + + + + +
Back to Previous Page
Site Map
OTN Homepage
+ +
+ +
+ + + diff --git a/molecule/filebeat/Dockerfile.j2 b/molecule/filebeat/Dockerfile.j2 old mode 100644 new mode 100755 diff --git a/molecule/filebeat/INSTALL.rst b/molecule/filebeat/INSTALL.rst old mode 100644 new mode 100755 diff --git a/molecule/filebeat/molecule.yml b/molecule/filebeat/molecule.yml old mode 100644 new mode 100755 diff --git a/molecule/filebeat/playbook.yml b/molecule/filebeat/playbook.yml old mode 100644 new mode 100755 diff --git a/molecule/filebeat/prepare.yml b/molecule/filebeat/prepare.yml old mode 100644 new mode 100755 diff --git a/molecule/filebeat/tests/test_default.py b/molecule/filebeat/tests/test_default.py old mode 100644 new mode 100755 diff --git a/molecule/kibana/Dockerfile.j2 b/molecule/kibana/Dockerfile.j2 old mode 100644 new mode 100755 diff --git a/molecule/kibana/INSTALL.rst b/molecule/kibana/INSTALL.rst old mode 100644 new mode 100755 diff --git a/molecule/kibana/molecule.yml b/molecule/kibana/molecule.yml old mode 100644 new mode 100755 diff --git a/molecule/kibana/playbook.yml b/molecule/kibana/playbook.yml old mode 100644 new mode 100755 diff --git a/molecule/kibana/prepare.yml b/molecule/kibana/prepare.yml old mode 100644 new mode 100755 diff --git a/molecule/kibana/tests/test_default.py b/molecule/kibana/tests/test_default.py old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/Dockerfile.j2 b/molecule/wazuh-agent/Dockerfile.j2 old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/INSTALL.rst b/molecule/wazuh-agent/INSTALL.rst old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/molecule.yml b/molecule/wazuh-agent/molecule.yml old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/playbook.yml b/molecule/wazuh-agent/playbook.yml old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/prepare.yml b/molecule/wazuh-agent/prepare.yml old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/tests/test_agents.py b/molecule/wazuh-agent/tests/test_agents.py old mode 100644 new mode 100755 diff --git a/molecule/wazuh-agent/tests/test_manager.py b/molecule/wazuh-agent/tests/test_manager.py old mode 100644 new mode 100755 diff --git a/playbooks/wazuh-agent.yml b/playbooks/wazuh-agent.yml old mode 100644 new mode 100755 diff --git a/playbooks/wazuh-elastic.yml b/playbooks/wazuh-elastic.yml old mode 100644 new mode 100755 diff --git a/playbooks/wazuh-elastic_stack-distributed.yml b/playbooks/wazuh-elastic_stack-distributed.yml old mode 100644 new mode 100755 diff --git a/playbooks/wazuh-elastic_stack-single.yml b/playbooks/wazuh-elastic_stack-single.yml old mode 100644 new mode 100755 diff --git a/playbooks/wazuh-kibana.yml b/playbooks/wazuh-kibana.yml old mode 100644 new mode 100755 diff --git a/playbooks/wazuh-manager.yml b/playbooks/wazuh-manager.yml old mode 100644 new mode 100755 diff --git a/roles/ansible-galaxy/meta/main.yml b/roles/ansible-galaxy/meta/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/README.md b/roles/elastic-stack/ansible-elasticsearch/README.md old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/defaults/main.yml b/roles/elastic-stack/ansible-elasticsearch/defaults/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/handlers/main.yml b/roles/elastic-stack/ansible-elasticsearch/handlers/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/meta/main.yml b/roles/elastic-stack/ansible-elasticsearch/meta/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/RMDebian.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/RMDebian.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/RMRedHat.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/RMRedHat.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml old mode 100644 new mode 100755 index 776f8b36..5ca11b67 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml @@ -197,7 +197,7 @@ when: - elasticsearch_xpack_security -- name: Reload systemd +- name: Distribution != one of [ centos 6.*, trusty ] | Reload systemd systemd: daemon_reload=true ignore_errors: true when: @@ -205,12 +205,37 @@ - not (ansible_distribution == "Ubuntu" and ansible_distribution_version is version('15.04', '<')) - not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<')) - not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<')) +- name: Get Java version + shell: java -version |& awk -F'"' '{print $2}' + register: java_version + +- debug: msg="{{ java_version.stdout_lines }}" + +- name: "Install Java Repo for Trusty" + yum_repository: repo='ppa:openjdk-r/ppa' + when: + - ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7 + +- name: Distribution is centos 6.* | Enable Elasticsearch + service: name=elasticsearch enabled=yes + +- name: Distribution is centos 6.* | Reload Elasticsearch + service: name=elasticsearch state=reloaded + +- name: Distribution is centos 6.* | Start Elasticsearch + service: name=elasticsearch state=started - name: Ensure Elasticsearch started and enabled service: name: elasticsearch enabled: true state: started + # ignore_errors: true + # when: + # - not (ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA") + # - not (ansible_distribution == "Ubuntu" and ansible_distribution_version is version('15.04', '<')) + # - not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<')) + # - not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<')) - name: Make sure Elasticsearch is running before proceeding wait_for: host={{ elasticsearch_network_host }} port={{ elasticsearch_http_port }} delay=3 timeout=300 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch_nonsystemd.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch_nonsystemd.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch_systemd.conf.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch_systemd.conf.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/instances.yml.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/instances.yml.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/jvm.options.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/jvm.options.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/wazuh-elastic6-template-alerts.json.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/wazuh-elastic6-template-alerts.json.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/wazuh-elastic7-template-alerts.json.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/wazuh-elastic7-template-alerts.json.j2 old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/README.md b/roles/elastic-stack/ansible-kibana/README.md old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/defaults/main.yml b/roles/elastic-stack/ansible-kibana/defaults/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/handlers/main.yml b/roles/elastic-stack/ansible-kibana/handlers/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/meta/main.yml b/roles/elastic-stack/ansible-kibana/meta/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/tasks/Debian.yml b/roles/elastic-stack/ansible-kibana/tasks/Debian.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/tasks/RMDebian.yml b/roles/elastic-stack/ansible-kibana/tasks/RMDebian.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/tasks/RMRedHat.yml b/roles/elastic-stack/ansible-kibana/tasks/RMRedHat.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/tasks/RedHat.yml b/roles/elastic-stack/ansible-kibana/tasks/RedHat.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/tasks/main.yml b/roles/elastic-stack/ansible-kibana/tasks/main.yml old mode 100644 new mode 100755 diff --git a/roles/elastic-stack/ansible-kibana/templates/kibana.yml.j2 b/roles/elastic-stack/ansible-kibana/templates/kibana.yml.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/README.md b/roles/wazuh/ansible-filebeat/README.md old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/defaults/main.yml b/roles/wazuh/ansible-filebeat/defaults/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/handlers/main.yml b/roles/wazuh/ansible-filebeat/handlers/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/meta/main.yml b/roles/wazuh/ansible-filebeat/meta/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tasks/Debian.yml b/roles/wazuh/ansible-filebeat/tasks/Debian.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tasks/RMDebian.yml b/roles/wazuh/ansible-filebeat/tasks/RMDebian.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tasks/RMRedHat.yml b/roles/wazuh/ansible-filebeat/tasks/RMRedHat.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tasks/RedHat.yml b/roles/wazuh/ansible-filebeat/tasks/RedHat.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tasks/config.yml b/roles/wazuh/ansible-filebeat/tasks/config.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tasks/main.yml b/roles/wazuh/ansible-filebeat/tasks/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/templates/elasticsearch.yml.j2 b/roles/wazuh/ansible-filebeat/templates/elasticsearch.yml.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/templates/filebeat.yml.j2 b/roles/wazuh/ansible-filebeat/templates/filebeat.yml.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tests/requirements.yml b/roles/wazuh/ansible-filebeat/tests/requirements.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-filebeat/tests/test.yml b/roles/wazuh/ansible-filebeat/tests/test.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/README.md b/roles/wazuh/ansible-wazuh-agent/README.md old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/defaults/main.yml b/roles/wazuh/ansible-wazuh-agent/defaults/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/handlers/main.yml b/roles/wazuh/ansible-wazuh-agent/handlers/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/meta/main.yml b/roles/wazuh/ansible-wazuh-agent/meta/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/RMDebian.yml b/roles/wazuh/ansible-wazuh-agent/tasks/RMDebian.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/RMRedHat.yml b/roles/wazuh/ansible-wazuh-agent/tasks/RMRedHat.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml b/roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/main.yml b/roles/wazuh/ansible-wazuh-agent/tasks/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-local-internal-options.conf.j2 b/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-local-internal-options.conf.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 b/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/vars/api_pass.yml b/roles/wazuh/ansible-wazuh-agent/vars/api_pass.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-agent/vars/authd_pass.yml b/roles/wazuh/ansible-wazuh-agent/vars/authd_pass.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/README.md b/roles/wazuh/ansible-wazuh-manager/README.md old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/defaults/main.yml b/roles/wazuh/ansible-wazuh-manager/defaults/main.yml old mode 100644 new mode 100755 index 8cf7ef58..ffa9bef2 --- a/roles/wazuh/ansible-wazuh-manager/defaults/main.yml +++ b/roles/wazuh/ansible-wazuh-manager/defaults/main.yml @@ -1,4 +1,6 @@ --- +wazuh_manager_api_version: 3.9.0 + wazuh_manager_fqdn: "wazuh-server" wazuh_manager_package_state: latest diff --git a/roles/wazuh/ansible-wazuh-manager/files/custom_ruleset/decoders/sample_custom_decoders.xml b/roles/wazuh/ansible-wazuh-manager/files/custom_ruleset/decoders/sample_custom_decoders.xml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/files/custom_ruleset/rules/sample_custom_rules.xml b/roles/wazuh/ansible-wazuh-manager/files/custom_ruleset/rules/sample_custom_rules.xml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/handlers/main.yml b/roles/wazuh/ansible-wazuh-manager/handlers/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/meta/main.yml b/roles/wazuh/ansible-wazuh-manager/meta/main.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/Debian.yml b/roles/wazuh/ansible-wazuh-manager/tasks/Debian.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/RMDebian.yml b/roles/wazuh/ansible-wazuh-manager/tasks/RMDebian.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/RMRedHat.yml b/roles/wazuh/ansible-wazuh-manager/tasks/RMRedHat.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/RedHat.yml b/roles/wazuh/ansible-wazuh-manager/tasks/RedHat.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/main.yml b/roles/wazuh/ansible-wazuh-manager/tasks/main.yml old mode 100644 new mode 100755 index 2715bba0..7064ba41 --- a/roles/wazuh/ansible-wazuh-manager/tasks/main.yml +++ b/roles/wazuh/ansible-wazuh-manager/tasks/main.yml @@ -5,19 +5,38 @@ - import_tasks: "Debian.yml" when: ansible_os_family == "Debian" -- name: Install wazuh-manager, wazuh-api and expect - package: pkg={{ item }} state={{ wazuh_manager_package_state }} +- name: CentOS/RedHat | Install wazuh-manager, wazuh-api and expect + package: pkg={{ item }}-{{ wazuh_manager_api_version }}-1 state={{ wazuh_manager_package_state }} with_items: - wazuh-manager - wazuh-api - - expect register: wazuh_manager_main_packages_installed until: wazuh_manager_main_packages_installed is succeeded when: - - not (ansible_distribution in ['CentOS','RedHat'] and ansible_distribution_major_version|int < 6) + - ansible_distribution in ['CentOS','RedHat'] tags: - init +- name: Debian/Ubuntu | Install wazuh-manager, wazuh-api and expect + apt: + name: "{{ item }}={{ wazuh_manager_api_version }}-1" + state: present + cache_valid_time: 3600 + with_items: + - wazuh-manager + - wazuh-api + register: wazuh_manager_main_packages_installed + until: wazuh_manager_main_packages_installed is succeeded + when: + - not (ansible_distribution in ['CentOS','RedHat']) + tags: init + +- name: Install expect + package: pkg=expect state={{ wazuh_manager_package_state }} + when: + - not (ansible_distribution in ['CentOS','RedHat'] and ansible_distribution_major_version|int < 6) + tags: init + - name: CentOS/RedHat 6 | Enabling python2.7 and sqlite3 replace: path: /etc/init.d/wazuh-manager @@ -30,7 +49,7 @@ - name: Install wazuh-manager and expect (EL5) package: pkg={{ item }} state={{ wazuh_manager_package_state }} with_items: - - wazuh-manager + - wazuh-manager-{{ wazuh_manager_api_version }} - expect register: wazuh_manager_main_packages_installed until: wazuh_manager_main_packages_installed is succeeded diff --git a/roles/wazuh/ansible-wazuh-manager/templates/agentless.j2 b/roles/wazuh/ansible-wazuh-manager/templates/agentless.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/api_user.j2 b/roles/wazuh/ansible-wazuh-manager/templates/api_user.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/authd_pass.j2 b/roles/wazuh/ansible-wazuh-manager/templates/authd_pass.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/cdb_lists.j2 b/roles/wazuh/ansible-wazuh-manager/templates/cdb_lists.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-api-configuration-config.js.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-api-configuration-config.js.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-local-internal-options.conf.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-local-internal-options.conf.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-rules-local_decoder.xml.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-rules-local_decoder.xml.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-rules-local_rules.xml.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-rules-local_rules.xml.j2 old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/vars/agentless_creds.yml b/roles/wazuh/ansible-wazuh-manager/vars/agentless_creds.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/vars/authd_pass.yml b/roles/wazuh/ansible-wazuh-manager/vars/authd_pass.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/vars/cdb_lists.yml b/roles/wazuh/ansible-wazuh-manager/vars/cdb_lists.yml old mode 100644 new mode 100755 diff --git a/roles/wazuh/ansible-wazuh-manager/vars/wazuh_api_creds.yml b/roles/wazuh/ansible-wazuh-manager/vars/wazuh_api_creds.yml old mode 100644 new mode 100755 From 873e9759ae0b250a1a19d415dd26e7f1d1bb700d Mon Sep 17 00:00:00 2001 From: rshad Date: Fri, 12 Jul 2019 13:06:02 +0000 Subject: [PATCH 3/8] Versioning and Ansible-Linting fixes are introduced to wazuh-agent and filebeat installations and testings --- molecule/filebeat/molecule.yml | 3 ++ molecule/filebeat/tests/test_default.py | 7 +++ molecule/wazuh-agent/tests/test_agents.py | 5 ++ .../wazuh/ansible-filebeat/defaults/main.yml | 2 + roles/wazuh/ansible-filebeat/tasks/main.yml | 50 +++++++++++++------ .../ansible-wazuh-agent/defaults/main.yml | 5 +- .../wazuh/ansible-wazuh-agent/tasks/Linux.yml | 16 +++++- .../ansible-wazuh-manager/tasks/main.yml | 4 +- 8 files changed, 72 insertions(+), 20 deletions(-) diff --git a/molecule/filebeat/molecule.yml b/molecule/filebeat/molecule.yml index 4f0bffb6..e456c4ae 100755 --- a/molecule/filebeat/molecule.yml +++ b/molecule/filebeat/molecule.yml @@ -5,6 +5,9 @@ driver: name: docker lint: name: yamllint + options: + config-data: + ignore: .virtualenv platforms: - name: trusty image: ubuntu:trusty diff --git a/molecule/filebeat/tests/test_default.py b/molecule/filebeat/tests/test_default.py index 72ac55d4..a959e48b 100755 --- a/molecule/filebeat/tests/test_default.py +++ b/molecule/filebeat/tests/test_default.py @@ -4,3 +4,10 @@ import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_filebeat_is_installed(host): + """Test if the elasticsearch package is installed.""" + filebeat = host.package("filebeat") + assert filebeat.is_installed + assert filebeat.version.startswith('7.1.1') diff --git a/molecule/wazuh-agent/tests/test_agents.py b/molecule/wazuh-agent/tests/test_agents.py index 5867dc2f..657cc9ee 100755 --- a/molecule/wazuh-agent/tests/test_agents.py +++ b/molecule/wazuh-agent/tests/test_agents.py @@ -7,6 +7,11 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('agent') +def get_wazuh_version(): + """This return the version of Wazuh.""" + return "3.9.0" + + def test_ossec_package_installed(Package): ossec = Package('wazuh-agent') assert ossec.is_installed diff --git a/roles/wazuh/ansible-filebeat/defaults/main.yml b/roles/wazuh/ansible-filebeat/defaults/main.yml index cfb892bd..541c0214 100755 --- a/roles/wazuh/ansible-filebeat/defaults/main.yml +++ b/roles/wazuh/ansible-filebeat/defaults/main.yml @@ -1,4 +1,6 @@ --- +filebeat_version: 7.1.1 + filebeat_create_config: true filebeat_prospectors: diff --git a/roles/wazuh/ansible-filebeat/tasks/main.yml b/roles/wazuh/ansible-filebeat/tasks/main.yml index 2dfa3ecd..7bafcc79 100755 --- a/roles/wazuh/ansible-filebeat/tasks/main.yml +++ b/roles/wazuh/ansible-filebeat/tasks/main.yml @@ -5,26 +5,40 @@ - import_tasks: Debian.yml when: ansible_os_family == 'Debian' -- name: Install Filebeat. - package: name=filebeat state=present +- name: CentOS/RedHat | Install Filebeat. + package: name=filebeat-{{ filebeat_version }} state=present register: filebeat_installing_package until: filebeat_installing_package is succeeded + when: + - ansible_distribution in ['CentOS','RedHat'] tags: - install +- name: Debian/Ubuntu | Install Filebeat. + apt: + name: filebeat={{ filebeat_version }} + state: present + cache_valid_time: 3600 + register: filebeat_installing_package_debian + until: filebeat_installing_package_debian is succeeded + when: + - not (ansible_distribution in ['CentOS','RedHat']) + tags: + - init + - name: Check if certificate exists locally stat: - path: "{{node_certs_destination}}/{{ filebeat_node_name }}.crt" + path: "{{ node_certs_destination }}/{{ filebeat_node_name }}.crt" register: certificate_file_exists when: - filebeat_xpack_security - name: Copy key & certificate files in generator node (locally) synchronize: - src: "{{node_certs_source}}/{{filebeat_node_name}}/" - dest: "{{node_certs_destination}}/" + src: "{{ node_certs_source }}/{{ filebeat_node_name }}/" + dest: "{{ node_certs_destination }}/" delegate_to: "{{ node_certs_generator_ip }}" - when: + when: - node_certs_generator - filebeat_xpack_security - not certificate_file_exists.stat.exists @@ -32,26 +46,30 @@ - name: Copy ca certificate file in generator node (locally) synchronize: - src: "{{node_certs_source}}/ca/" - dest: "{{node_certs_destination}}/" + src: "{{ node_certs_source }}/ca/" + dest: "{{ node_certs_destination }}/" delegate_to: "{{ node_certs_generator_ip }}" - when: + when: - node_certs_generator - filebeat_xpack_security - not certificate_file_exists.stat.exists register: check_certs_permissions tags: xpack-security - + - name: Importing key & certificate files from generator node - shell: "{{rsync_path}} {{rsync_extra_parameters}} {{rsync_user}}@{{node_certs_generator_ip}}:{{node_certs_source}}/{{filebeat_node_name}}/ {{node_certs_destination}}/" + command: >- + {{ rsync_path }} {{ rsync_extra_parameters }} {{ rsync_user }}@{{ node_certs_generator_ip }}: + {{ node_certs_source }}/{{ filebeat_node_name }}/ {{ node_certs_destination }}/ when: - not node_certs_generator - filebeat_xpack_security - not certificate_file_exists.stat.exists tags: xpack-security -- name: Importing ca certificate file from generator node - shell: "{{rsync_path}} {{rsync_extra_parameters}} {{rsync_user}}@{{node_certs_generator_ip}}:{{node_certs_source}}/ca/ {{node_certs_destination}}/" +- name: Importing ca certificate file from generator node + command: >- + {{ rsync_path }} {{ rsync_extra_parameters }} {{ rsync_user }}@{{ node_certs_generator_ip }}: + {{ node_certs_source }}/ca/ {{ node_certs_destination }}/ when: - not node_certs_generator - filebeat_xpack_security @@ -60,7 +78,11 @@ tags: xpack-security - name: Ensuring certificates folder owner - shell: "chmod -R 770 {{node_certs_destination}}/" + file: + path: "{{ node_certs_destination }}/" + mode: '0770' + recurse: yes + when: - check_certs_permissions is defined - filebeat_xpack_security diff --git a/roles/wazuh/ansible-wazuh-agent/defaults/main.yml b/roles/wazuh/ansible-wazuh-agent/defaults/main.yml index e95707e6..ded6d5b9 100755 --- a/roles/wazuh/ansible-wazuh-agent/defaults/main.yml +++ b/roles/wazuh/ansible-wazuh-agent/defaults/main.yml @@ -1,4 +1,5 @@ --- +wazuh_agent_version: 3.9.0 wazuh_managers: - address: 127.0.0.1 port: 1514 @@ -23,10 +24,10 @@ wazuh_winagent_config: install_dir_x86: 'C:\Program Files (x86)\ossec-agent\' auth_path: C:\'Program Files'\ossec-agent\agent-auth.exe auth_path_x86: C:\'Program Files (x86)'\ossec-agent\agent-auth.exe - version: '3.9.2' + version: '3.9.3' revision: '1' repo: https://packages.wazuh.com/3.x/windows/ - md5: 43936e7bc7eb51bd186f47dac4a6f477 + md5: c3fdbd6c121ca371b8abcd477ed4e8a4 wazuh_agent_config: active_response: ar_disabled: 'no' diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml index 2b644bde..faa28b57 100755 --- a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml @@ -5,10 +5,22 @@ - import_tasks: "Debian.yml" when: ansible_os_family == "Debian" -- name: Linux | Install wazuh-agent - package: name=wazuh-agent state=present +- name: Linux CentOS/RedHat | Install wazuh-agent + package: name=wazuh-agent-{{ wazuh_agent_version }}-1 state=present async: 90 poll: 30 + when: + - ansible_distribution in ['CentOS','RedHat'] + tags: + - init + +- name: Linux Debian | Install wazuh-agent + apt: + name: "wazuh-agent={{ wazuh_agent_version }}-1" + state: present + cache_valid_time: 3600 + when: + - not (ansible_distribution in ['CentOS','RedHat']) tags: - init diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/main.yml b/roles/wazuh/ansible-wazuh-manager/tasks/main.yml index 7064ba41..30e5ec87 100755 --- a/roles/wazuh/ansible-wazuh-manager/tasks/main.yml +++ b/roles/wazuh/ansible-wazuh-manager/tasks/main.yml @@ -5,7 +5,7 @@ - import_tasks: "Debian.yml" when: ansible_os_family == "Debian" -- name: CentOS/RedHat | Install wazuh-manager, wazuh-api and expect +- name: CentOS/RedHat | Install wazuh-manager, wazuh-api package: pkg={{ item }}-{{ wazuh_manager_api_version }}-1 state={{ wazuh_manager_package_state }} with_items: - wazuh-manager @@ -17,7 +17,7 @@ tags: - init -- name: Debian/Ubuntu | Install wazuh-manager, wazuh-api and expect +- name: Debian/Ubuntu | Install wazuh-manager, wazuh-api apt: name: "{{ item }}={{ wazuh_manager_api_version }}-1" state: present From d08b013224db9041b141a92c5880f62736019dee Mon Sep 17 00:00:00 2001 From: rshad Date: Fri, 12 Jul 2019 14:24:31 +0000 Subject: [PATCH 4/8] Kibana test is probably fixed, saving changes ... --- molecule/kibana/molecule.yml | 3 ++ molecule/kibana/tests/test_default.py | 2 +- .../ansible-kibana/tasks/main.yml | 40 ++++++++++++------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/molecule/kibana/molecule.yml b/molecule/kibana/molecule.yml index a1e0e3f9..c1191c07 100755 --- a/molecule/kibana/molecule.yml +++ b/molecule/kibana/molecule.yml @@ -5,6 +5,9 @@ driver: name: docker lint: name: yamllint + options: + config-data: + ignore: .virtualenv platforms: - name: bionic image: solita/ubuntu-systemd:bionic diff --git a/molecule/kibana/tests/test_default.py b/molecule/kibana/tests/test_default.py index 936f6cfc..f510aed9 100755 --- a/molecule/kibana/tests/test_default.py +++ b/molecule/kibana/tests/test_default.py @@ -14,7 +14,7 @@ def test_port_kibana_is_open(host): def test_find_correct_elasticsearch_version(host): """Test if we find the kibana/elasticsearch version in package.json""" kibana = host.file("/usr/share/kibana/plugins/wazuh/package.json") - assert kibana.contains("6.7.1") + assert kibana.contains("7.1.1") def test_wazuh_plugin_installed(host): diff --git a/roles/elastic-stack/ansible-kibana/tasks/main.yml b/roles/elastic-stack/ansible-kibana/tasks/main.yml index 43dfd57e..4e12b1b2 100755 --- a/roles/elastic-stack/ansible-kibana/tasks/main.yml +++ b/roles/elastic-stack/ansible-kibana/tasks/main.yml @@ -16,17 +16,17 @@ - name: Check if certificate exists locally stat: - path: "{{node_certs_destination}}/{{ kibana_node_name }}.crt" + path: "{{ node_certs_destination }}/{{ kibana_node_name }}.crt" register: certificate_file_exists when: - - kibana_xpack_security + - kibana_xpack_security - name: Copy key & certificate files in generator node (locally) synchronize: - src: "{{node_certs_source}}/{{kibana_node_name}}/" - dest: "{{node_certs_destination}}/" + src: "{{ node_certs_source }}/{{ kibana_node_name }}/" + dest: "{{ node_certs_destination }}/" delegate_to: "{{ node_certs_generator_ip }}" - when: + when: - node_certs_generator - kibana_xpack_security - not certificate_file_exists.stat.exists @@ -34,25 +34,29 @@ - name: Copy ca certificate file in generator node (locally) synchronize: - src: "{{node_certs_source}}/ca/" - dest: "{{node_certs_destination}}/" + src: "{{ node_certs_source }}/ca/" + dest: "{{ node_certs_destination }}/" delegate_to: "{{ node_certs_generator_ip }}" - when: + when: - node_certs_generator - kibana_xpack_security - not certificate_file_exists.stat.exists tags: xpack-security - + - name: Importing key & certificate files from generator node - shell: "{{rsync_path}} {{rsync_extra_parameters}} {{rsync_user}}@{{node_certs_generator_ip}}:{{node_certs_source}}/{{kibana_node_name}}/ {{node_certs_destination}}/" + command: >- + {{ rsync_path }} {{ rsync_extra_parameters }} {{ rsync_user }}@{{ node_certs_generator_ip }}: + {{ node_certs_source }}/{{ kibana_node_name }}/ {{ node_certs_destination }}/ when: - not node_certs_generator - kibana_xpack_security - not certificate_file_exists.stat.exists tags: xpack-security -- name: Importing ca certificate file from generator node - shell: "{{rsync_path}} {{rsync_extra_parameters}} {{rsync_user}}@{{node_certs_generator_ip}}:{{node_certs_source}}/ca/ {{node_certs_destination}}/" +- name: Importing ca certificate file from generator node + command: >- + {{ rsync_path }} {{ rsync_extra_parameters }} {{ rsync_user }}@{{ node_certs_generator_ip }}: + {{ node_certs_source }}/ca/ {{ node_certs_destination }}/ when: - not node_certs_generator - kibana_xpack_security @@ -61,14 +65,22 @@ tags: xpack-security - name: Ensuring certificates folder owner - shell: "chown -R kibana: {{node_certs_destination}}/" + file: + path: "{{ node_certs_destination }}/" + state: directory + recurse: yes + owner: kibana + group: kibana when: - check_certs_permissions is defined - kibana_xpack_security tags: xpack-security - name: Ensuring certificates folder owner - shell: "chmod -R 770 {{node_certs_destination}}/" + file: + path: "{{ node_certs_destination }}/" + mode: '0770' + recurse: yes when: - check_certs_permissions is defined - kibana_xpack_security From df428f5f52632bb3cf0d7163f2c05346cefae95d Mon Sep 17 00:00:00 2001 From: Rshad Zhran Date: Mon, 15 Jul 2019 14:04:13 +0200 Subject: [PATCH 5/8] fixed elasticsearch installation for Centos 6.* - Adding Java Installation --- molecule/elasticsearch/molecule.yml | 2 +- molecule/elasticsearch/tests/test_default.py | 2 +- .../ansible-elasticsearch/tasks/RedHat.yml | 5 ++++ .../ansible-elasticsearch/tasks/main.yml | 24 +++++++++++-------- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml index 585614b2..a7e3c26f 100755 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -41,7 +41,7 @@ platforms: # memory_reservation: 1024m # privileged: true # ulimits: - - nofile:262144:262144 + # - nofile:262144:262144 provisioner: name: ansible playbooks: diff --git a/molecule/elasticsearch/tests/test_default.py b/molecule/elasticsearch/tests/test_default.py index 8b453255..34fce3b3 100755 --- a/molecule/elasticsearch/tests/test_default.py +++ b/molecule/elasticsearch/tests/test_default.py @@ -10,7 +10,7 @@ def test_elasticsearch_is_installed(host): """Test if the elasticsearch package is installed.""" elasticsearch = host.package("elasticsearch") assert elasticsearch.is_installed - assert elasticsearch.version.startswith('6.7.1') + assert elasticsearch.version.startswith('7.1.1') def test_elasticsearch_is_running(host): diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml index 16366dfc..fbefe51e 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml @@ -9,6 +9,11 @@ gpgcheck: true changed_when: false +- name: CentOS x.x => x.x < 7.0 | Installing Java + yum: + name: java-1.8.0-openjdk.x86_64 + state: present + - name: RedHat/CentOS/Fedora | Install Elasticsarch package: name=elasticsearch-{{ elastic_stack_version }} state=present tags: install diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml index 5ca11b67..c29dc760 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml @@ -205,22 +205,26 @@ - not (ansible_distribution == "Ubuntu" and ansible_distribution_version is version('15.04', '<')) - not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<')) - not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<')) -- name: Get Java version - shell: java -version |& awk -F'"' '{print $2}' - register: java_version -- debug: msg="{{ java_version.stdout_lines }}" +#- name: Get Java version +# shell: java -version |& awk -F'"' '{print $2}' +# register: java_version +# ignore_errors: true -- name: "Install Java Repo for Trusty" - yum_repository: repo='ppa:openjdk-r/ppa' - when: - - ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7 +# - debug: msg="{{ java_version.stdout_lines }}" + +#- name: "Install Java Repo for Trusty" +# yum_repository: repo='ppa:openjdk-r/ppa' +# when: +# - ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7 - name: Distribution is centos 6.* | Enable Elasticsearch service: name=elasticsearch enabled=yes -- name: Distribution is centos 6.* | Reload Elasticsearch - service: name=elasticsearch state=reloaded + +#- name: Distribution is centos 6.* | Reload Elasticsearch +# service: name=elasticsearch state=reloaded +# state: "{{ elasticsearch_state | default('reloaded') }}" - name: Distribution is centos 6.* | Start Elasticsearch service: name=elasticsearch state=started From eb70809add79d1159db57f587dbad7a5c837c616 Mon Sep 17 00:00:00 2001 From: Rshad Zhran Date: Mon, 15 Jul 2019 17:06:13 +0200 Subject: [PATCH 6/8] fixed Elasticsearch installation's issues caused by the absense of Java in Ubuntu Trusty --- molecule/elasticsearch/molecule.yml | 16 ++++----- .../ansible-elasticsearch/tasks/Debian.yml | 36 +++++++++++++++++++ .../ansible-elasticsearch/tasks/RedHat.yml | 2 ++ .../ansible-elasticsearch/tasks/main.yml | 23 ------------ 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml index a7e3c26f..fbb06add 100755 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -25,17 +25,17 @@ platforms: # command: /sbin/init # ulimits: # - nofile:262144:262144 - #- name: trusty - #image: ubuntu:trusty - #memory_reservation: 1024m - #ulimits: - #- nofile:262144:262144 - - name: centos6 - image: centos:6 - privileged: true + - name: trusty + image: ubuntu:trusty memory_reservation: 1024m ulimits: - nofile:262144:262144 +# - name: centos6 +# image: centos:6 +# privileged: true +# memory_reservation: 1024m +# ulimits: +# - nofile:262144:262144 # - name: centos7 # image: milcom/centos7-systemd # memory_reservation: 1024m diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml index 1555f443..17b968cc 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml @@ -14,6 +14,42 @@ - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 +- name: Update and upgrade apt packages + become: true + apt: + upgrade: yes + update_cache: yes + cache_valid_time: 86400 #One day + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version | int == 14 + +- name: Install Oracle Java 8 + become: yes + apt: name=openjdk-8-jdk state=latest + + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version | int == 14 + +- name: Set the default Java version + become: yes + shell: update-alternatives --config java + +- name: Set the default Javac version + become: yes + shell: update-alternatives --config javac + +- name: Update and upgrade apt packages + become: true + apt: + upgrade: yes + update_cache: yes + cache_valid_time: 86400 #One day + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version | int == 14 + - name: Debian/Ubuntu | Add Elasticsearch GPG key. apt_key: url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch" diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml index fbefe51e..81176ee0 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/RedHat.yml @@ -13,6 +13,8 @@ yum: name: java-1.8.0-openjdk.x86_64 state: present + when: + - ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7 - name: RedHat/CentOS/Fedora | Install Elasticsarch package: name=elasticsearch-{{ elastic_stack_version }} state=present diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml index c29dc760..56a3157b 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml @@ -206,26 +206,9 @@ - not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<')) - not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<')) -#- name: Get Java version -# shell: java -version |& awk -F'"' '{print $2}' -# register: java_version -# ignore_errors: true - -# - debug: msg="{{ java_version.stdout_lines }}" - -#- name: "Install Java Repo for Trusty" -# yum_repository: repo='ppa:openjdk-r/ppa' -# when: -# - ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7 - - name: Distribution is centos 6.* | Enable Elasticsearch service: name=elasticsearch enabled=yes - -#- name: Distribution is centos 6.* | Reload Elasticsearch -# service: name=elasticsearch state=reloaded -# state: "{{ elasticsearch_state | default('reloaded') }}" - - name: Distribution is centos 6.* | Start Elasticsearch service: name=elasticsearch state=started @@ -234,12 +217,6 @@ name: elasticsearch enabled: true state: started - # ignore_errors: true - # when: - # - not (ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA") - # - not (ansible_distribution == "Ubuntu" and ansible_distribution_version is version('15.04', '<')) - # - not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<')) - # - not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<')) - name: Make sure Elasticsearch is running before proceeding wait_for: host={{ elasticsearch_network_host }} port={{ elasticsearch_http_port }} delay=3 timeout=300 From fc38d565d9d9e6839dbe1ad6f3b641a8865534f3 Mon Sep 17 00:00:00 2001 From: Rshad Zhran Date: Tue, 16 Jul 2019 12:29:07 +0200 Subject: [PATCH 7/8] fixed Elasticsearch installation's issues related to Idempotence test - Test passed successfully --- molecule/elasticsearch/molecule.yml | 46 +++++++++---------- .../ansible-elasticsearch/tasks/Debian.yml | 20 +++++--- .../ansible-elasticsearch/tasks/main.yml | 1 - 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml index fbb06add..6860b0f3 100755 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -3,45 +3,43 @@ dependency: name: galaxy driver: name: docker -#lint: -# name: yamllint lint: name: yamllint options: config-data: ignore: .virtualenv platforms: - # - name: 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: 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 image: ubuntu:trusty - memory_reservation: 1024m + memory_reservation: 2048m ulimits: - nofile:262144:262144 # - name: centos6 # image: centos:6 # privileged: true -# memory_reservation: 1024m +# memory_reservation: 2048m +# ulimits: +# - nofile:262144:262144 +# - name: centos7 +# image: milcom/centos7-systemd +# memory_reservation: 2048m +# privileged: true # ulimits: # - nofile:262144:262144 - # - name: centos7 - # image: milcom/centos7-systemd - # memory_reservation: 1024m - # privileged: true - # ulimits: - # - nofile:262144:262144 provisioner: name: ansible playbooks: diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml index 17b968cc..642e2ee9 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml @@ -32,13 +32,19 @@ - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 -- name: Set the default Java version - become: yes - shell: update-alternatives --config java +#- name: Set the default Java version +# become: yes +# shell: update-alternatives --config java +# when: +# - ansible_distribution == "Ubuntu" +# - ansible_distribution_major_version | int == 14# -- name: Set the default Javac version - become: yes - shell: update-alternatives --config javac +#- name: Set the default Javac version +# become: yes +# shell: update-alternatives --config javac +# when: +# - ansible_distribution == "Ubuntu" +# - ansible_distribution_major_version | int == 14 - name: Update and upgrade apt packages become: true @@ -55,12 +61,14 @@ url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch" state: present + - name: Debian/Ubuntu | Install Elastic repo apt_repository: repo: 'deb https://artifacts.elastic.co/packages/7.x/apt stable main' state: present filename: 'elastic_repo' update_cache: true + changed_when: false - name: Debian/Ubuntu | Install Elasticsarch apt: diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml index 56a3157b..2d446798 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml @@ -253,6 +253,5 @@ - import_tasks: "RMRedHat.yml" when: ansible_os_family == "RedHat" - - import_tasks: "RMDebian.yml" when: ansible_os_family == "Debian" From 687797a66cd7d7aff3a3b36916182f1950a25453 Mon Sep 17 00:00:00 2001 From: Rshad Zhran Date: Tue, 16 Jul 2019 17:23:09 +0200 Subject: [PATCH 8/8] ignored Ubuntu Trusty in Testing --- molecule/elasticsearch/molecule.yml | 57 ++++++++++--------- molecule/kibana/molecule.yml | 10 ++-- .../ansible-elasticsearch/tasks/Debian.yml | 14 ----- .../ansible-elasticsearch/tasks/main.yml | 23 ++++++++ 4 files changed, 57 insertions(+), 47 deletions(-) diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml index 6860b0f3..20d68047 100755 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -9,37 +9,38 @@ lint: config-data: ignore: .virtualenv platforms: -# - name: 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 - image: ubuntu:trusty + - name: 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 +# image: ubuntu:trusty +# privileged: true +# memory_reservation: 2048m +# ulimits: +# - nofile:262144:262144 + - name: centos6 + image: centos:6 + privileged: true memory_reservation: 2048m ulimits: - nofile:262144:262144 -# - name: centos6 -# image: centos:6 -# privileged: true -# memory_reservation: 2048m -# ulimits: -# - nofile:262144:262144 -# - name: centos7 -# image: milcom/centos7-systemd -# memory_reservation: 2048m -# privileged: true -# ulimits: -# - nofile:262144:262144 + - name: centos7 + image: milcom/centos7-systemd + memory_reservation: 2048m + privileged: true + ulimits: + - nofile:262144:262144 provisioner: name: ansible playbooks: diff --git a/molecule/kibana/molecule.yml b/molecule/kibana/molecule.yml index c1191c07..2017a6bd 100755 --- a/molecule/kibana/molecule.yml +++ b/molecule/kibana/molecule.yml @@ -23,11 +23,11 @@ platforms: command: /sbin/init ulimits: - nofile:262144:262144 - - name: trusty - image: ubuntu:trusty - memory_reservation: 1024m - ulimits: - - nofile:262144:262144 +# - name: trusty +# image: ubuntu:trusty +# memory_reservation: 1024m +# ulimits: +# - nofile:262144:262144 - name: centos6 image: centos:6 privileged: true diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml index 642e2ee9..f6c0e6cc 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/Debian.yml @@ -32,20 +32,6 @@ - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 -#- name: Set the default Java version -# become: yes -# shell: update-alternatives --config java -# when: -# - ansible_distribution == "Ubuntu" -# - ansible_distribution_major_version | int == 14# - -#- name: Set the default Javac version -# become: yes -# shell: update-alternatives --config javac -# when: -# - ansible_distribution == "Ubuntu" -# - ansible_distribution_major_version | int == 14 - - name: Update and upgrade apt packages become: true apt: diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml index 2d446798..9678f8cb 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml @@ -197,6 +197,28 @@ when: - elasticsearch_xpack_security +- name: Trusty | set MAX_LOCKED_MEMORY=unlimited in Elasticsearch in /etc/security/limits.conf + lineinfile: + path: /etc/security/limits.conf + line: elasticsearch - memlock unlimited + create: yes + become: yes + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version | int == 14 + changed_when: false + +- name: Trusty | set MAX_LOCKED_MEMORY=unlimited in Elasticsearch in /etc/security/limits.d/elasticsearch.conf + lineinfile: + path: /etc/security/limits.d/elasticsearch.conf + line: elasticsearch - memlock unlimited + create: yes + become: yes + changed_when: false + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version | int == 14 + - name: Distribution != one of [ centos 6.*, trusty ] | Reload systemd systemd: daemon_reload=true ignore_errors: true @@ -211,6 +233,7 @@ - name: Distribution is centos 6.* | Start Elasticsearch service: name=elasticsearch state=started + ignore_errors: true - name: Ensure Elasticsearch started and enabled service: