Update Wazuh installation tasks. Added Product key to avoid reinstalling Agent

This commit is contained in:
Jose M 2019-09-09 13:04:45 +02:00
parent 9f84bfe15a
commit ea69b7fc9b

View File

@ -18,34 +18,36 @@
when: when:
- not check_path.stat.exists - not check_path.stat.exists
- name: Windows | Downloading windows Wazuh agent installer - name: Windows | Check if Wazuh installer is already downloaded
win_get_url:
dest: C:\wazuh-agent-installer.msi
url: "{{ wazuh_winagent_config.repo }}wazuh-agent-{{ wazuh_winagent_config.version }}-{{ wazuh_winagent_config.revision }}.msi"
when:
- correct_version is not defined
- name: Windows | Verify the downloaded Wazuh agent installer
win_stat: win_stat:
path: C:\wazuh-agent-installer.msi path: "{{ wazuh_winagent_config.download_dir }}wazuh-agent-{{ wazuh_winagent_config.version }}-{{ wazuh_winagent_config.revision }}.msi"
register: wazuh_package_downloaded
- name: Windows | Download Wazuh Agent package
win_get_url:
url: "{{ wazuh_winagent_config.repo }}wazuh-agent-{{ wazuh_winagent_config.version }}-{{ wazuh_winagent_config.revision }}.msi"
dest: "{{ wazuh_winagent_config.download_dir }}"
when:
- not wazuh_package_downloaded.stat.exists
- name: Windows | Verify the Wazuh Agent installer
win_stat:
path: "{{ wazuh_winagent_config.download_dir }}wazuh-agent-{{ wazuh_winagent_config.version }}-{{ wazuh_winagent_config.revision }}.msi"
get_checksum: true get_checksum: true
checksum_algorithm: md5 checksum_algorithm: md5
register: installer_md5 register: wazuh_agent_status
when:
- correct_version is not defined
failed_when: failed_when:
- installer_md5.stat.checksum != wazuh_winagent_config.md5 - wazuh_agent_status.stat.checksum != wazuh_winagent_config.md5
- name: Windows | Install Wazuh agent - name: Windows | Install Agent if not already installed
win_package: win_package:
path: C:\wazuh-agent-installer.msi path: "{{ wazuh_winagent_config.download_dir }}wazuh-agent-{{ wazuh_winagent_config.version }}-{{ wazuh_winagent_config.revision }}.msi"
when: product_id: '{9903C258-FC1E-4886-B7DB-1535976EC1D5}'
- correct_version is not defined state: present
- name: Windows | Check if client.keys exists - name: Windows | Check if client.keys exists
win_stat: path="{{ wazuh_agent_win_path }}" win_stat: path="{{ wazuh_agent_win_path }}client.keys"
register: check_windows_key register: check_windows_key
notify: restart wazuh-agent windows
tags: tags:
- config - config