Closed roronoasins closed 11 months ago
I have added the manager role to the repo within qa-system-framework/provisioning/roles/wazuh/manager
path but I had the followings errors when trying to use the handler as wazuh-ansible
TASK [../roles/wazuh/manager : Ensure Wazuh Manager service is started and enabled.] *************************************************************************************************************************
fatal: [manager1]: FAILED! => {"changed": false, "msg": "Unable to enable service wazuh-manager: Synchronizing state of wazuh-manager.service with SysV service script with /lib/systemd/systemd-sysv-install.\nExecuting: /lib/systemd/systemd-sysv-install enable wazuh-manager\nFailed to reload daemon: Method call timed out\nupdate-rc.d: error: no runlevel symlinks to modify, aborting!\n"}
Don't know if the handler is triggered or skipped since there is no logging about handlers. Tried to manually import it but nothing happened
Tomorrow will try to fix this or even add a new handler that uses wazuh-control
instead or another way
The first provisioning structure is like follows:
qa-system-framework/
|-- provisioning/
| |-- playbooks/
| `-- roles/
| `-- wazuh/
| |-- manager/
| | |-- defauts/
| | |-- handlers/
| | |-- meta/
| | `-- tasks/
| `-- vars/
|-- src/
| `-- ...
|-- tests/
| `-- ...
`-- ...
It is possible to install the manager both via repo or custom package. Here we have both scenarios reproduced:
Many OS support is getting added to the agents' provisioning.
Currently it's working for Debian and RedHat. Besides, it is being added the rest of Deployer's supported OS, like Windows, Solaris, MacOS, etc.
The following OS are currently working:
Has been added support for both ECS and EC2 instances. Also, we can use a var to define the version that we want install via repo. For MacOS it freezes during the installation task
And these issues were reported during the research/dev:
It is required to discuss if we want just to install the components or also check that everything is correct after the service starts
I've been working on adding the become
to the playbook instead of having it in each task that is required in linux systems. I could not make this work.
This is required since windows can't use the
become
var: windows da error por usar become cuando no se usa en su item sino en el anterior fatal: [winagent1]: FAILED! => {"msg": "The powershell shell family is incompatible with the sudo become plugin"}
To achieve that I tried these workarounds:
Set the become var using bools/conditionals
become: "{{ ansible_os_family != 'Windows' }}"
become: "{{ (true if (ansible_facts['os_family'] != 'Windows'))|default(false)|bool }}"
Use tasks to set the become var for each role
tasks:
- name: set become
set_fact:
become: "{{ (true if (ansible_facts['os_family'] != 'Windows')) or (false if (ansible_facts['os_family'] == 'Windows')) }}"
- name: show become value
debug:
msg: "become value: {{ become }}"
Split the roles in two
- hosts: all
roles:
- role: ../roles/wazuh/agent
hosts: winagent
when: "'winagent' in group_names"
- role: ../roles/wazuh/agent
become: true
hosts: agent
when: "'agent' in group_names"
the vars are inherited from the first role item
So we'll maintain the individual becomes within the tasks that require them.
Also, there is a thing about MacOS instances. Don't know if it is a coincidence but the pkg installation won't end if it is run for a second time
TASK [../roles/wazuh/agent : Install MacOS agent from pkg | custom macos pkg] ********************************************************************************************************************************
Solaris and MacOS instances are installed now correctly. Tomorrow will check that everything works as expected for every service and installation.
managers:
agents:
/var/ossec/bin/agent_control -l
Description
As a part of #57, we need to add a folder structure to the upcoming roles and some of them. We can start with the pair of manager-agent.
We will use the roles and playbooks from
wazuh-ansible
as a reference.