change installation directory (#116)

This commit is contained in:
Carlos Dominguez 2018-12-27 12:52:27 +01:00 committed by Jesús Linares
parent 9327f052de
commit e94a0cf473
2 changed files with 20 additions and 10 deletions

View File

@ -19,7 +19,10 @@ wazuh_notify_time: '10'
wazuh_time_reconnect: '60'
wazuh_crypto_method: 'aes'
wazuh_winagent_config:
install_dir: 'C:\wazuh-agent\'
install_dir: 'C:\Program Files\ossec-agent\'
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.7.0'
revision: '1'
repo: https://packages.wazuh.com/3.x/windows/

View File

@ -1,8 +1,15 @@
---
- name: Windows | Check if Program Files (x86) exists
win_stat:
path: C:\Program Files (x86)
register: check_path
- name: Windows | Get current installed version
win_shell: "{{ wazuh_winagent_config.install_dir }}ossec-agent.exe -h"
win_shell: "{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.install_dir_x86 }}{% else %}
{{ wazuh_winagent_config.install_dir }}{% endif %}ossec-agent.exe -h"
args:
removes: "{{ wazuh_winagent_config.install_dir }}ossec-agent.exe"
removes: "{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.install_dir_x86 }}{% else %}
{{ wazuh_winagent_config.install_dir }}{% endif %}ossec-agent.exe"
register: agent_version
failed_when: False
changed_when: False
@ -34,12 +41,11 @@
- name: Windows | Install Wazuh agent
win_package:
path: C:\wazuh-agent-installer.msi
arguments: APPLICATIONFOLDER={{ wazuh_winagent_config.install_dir }}
when:
- correct_version is not defined
- name: Windows | Check if client.keys exists
win_stat: path="{{ wazuh_winagent_config.install_dir }}client.keys"
win_stat: path="{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.install_dir_x86 }}{% else %}{{ wazuh_winagent_config.install_dir }}{% endif %}client.keys"
register: check_windows_key
notify: restart wazuh-agent windows
tags:
@ -52,12 +58,13 @@
- name: Windows | Register agent
win_shell: >
{{ wazuh_winagent_config.install_dir }}agent-auth.exe
{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.auth_path_x86 }}{% else %}
{{ wazuh_winagent_config.auth_path }}{% endif %}
-m {{ wazuh_managers.0.address }}
-p {{ wazuh_agent_authd.port }}
{% if authd_pass is defined %}-P {{ authd_pass }}{% endif %}
{% if authd_pass is defined %} -P {{ authd_pass }}{% endif %}
args:
chdir: "{{ wazuh_winagent_config.install_dir }}"
chdir: "{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.install_dir_x86 }}{% else %}{{ wazuh_winagent_config.install_dir }}{% endif %}"
register: agent_auth_output
notify: restart wazuh-agent windows
when:
@ -70,7 +77,7 @@
- name: Windows | Installing agent configuration (ossec.conf)
win_template:
src: var-ossec-etc-ossec-agent.conf.j2
dest: "{{ wazuh_winagent_config.install_dir }}ossec.conf"
dest: "{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.install_dir_x86 }}{% else %}{{ wazuh_winagent_config.install_dir }}{% endif %}ossec.conf"
notify: restart wazuh-agent windows
tags:
- config
@ -78,7 +85,7 @@
- name: Windows | Installing local_internal_options.conf
win_template:
src: var-ossec-etc-local-internal-options.conf.j2
dest: "{{ wazuh_winagent_config.install_dir }}local_internal_options.conf"
dest: "{% if check_path.stat.exists == true %}{{ wazuh_winagent_config.install_dir_x86 }}{% else %}{{ wazuh_winagent_config.install_dir }}{% endif %}local_internal_options.conf"
notify: restart wazuh-agent windows
tags:
- config