diff --git a/playbooks/wazuh-opensearch-production-ready.yml b/playbooks/wazuh-opensearch-production-ready.yml index f8542096..e52cfca7 100644 --- a/playbooks/wazuh-opensearch-production-ready.yml +++ b/playbooks/wazuh-opensearch-production-ready.yml @@ -119,7 +119,7 @@ hidden: 'no' wazuh_api_users: - username: custom-user - password: SecretPassword! + password: SecretPassword1! filebeat_output_indexer_hosts: - "{{ hostvars.wi1.private_ip }}" - "{{ hostvars.wi2.private_ip }}" diff --git a/roles/wazuh/ansible-wazuh-manager/files/create_user.py b/roles/wazuh/ansible-wazuh-manager/files/create_user.py index 5ecb88e2..abb44eec 100644 --- a/roles/wazuh/ansible-wazuh-manager/files/create_user.py +++ b/roles/wazuh/ansible-wazuh-manager/files/create_user.py @@ -97,6 +97,6 @@ if __name__ == "__main__": password=password, ) # disable unused default users - for def_user in ['wazuh', 'wazuh-wui']: - if def_user != username: - disable_user(initial_users[def_user]) \ No newline at end of file + #for def_user in ['wazuh', 'wazuh-wui']: + # if def_user != username: + # disable_user(initial_users[def_user]) \ No newline at end of file diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/main.yml b/roles/wazuh/ansible-wazuh-manager/tasks/main.yml index b7640a5c..65ded135 100644 --- a/roles/wazuh/ansible-wazuh-manager/tasks/main.yml +++ b/roles/wazuh/ansible-wazuh-manager/tasks/main.yml @@ -260,6 +260,15 @@ group: wazuh mode: 0644 + - name: Create admin.json + template: + src: templates/admin.json.j2 + dest: "{{ wazuh_dir }}/api/configuration/admin.json" + owner: wazuh + group: wazuh + mode: 0644 + no_log: true + - name: Execute create_user script script: chdir: "{{ wazuh_dir }}/framework/scripts/" diff --git a/roles/wazuh/ansible-wazuh-manager/templates/admin.json.j2 b/roles/wazuh/ansible-wazuh-manager/templates/admin.json.j2 new file mode 100644 index 00000000..6522f530 --- /dev/null +++ b/roles/wazuh/ansible-wazuh-manager/templates/admin.json.j2 @@ -0,0 +1,4 @@ + +{% for api in wazuh_api_users %} +{"username":"{{ api['username'] }}", "password": "{{ api['password'] }}"} +{% endfor %} \ No newline at end of file