68 lines
2.0 KiB
YAML
68 lines
2.0 KiB
YAML
---
|
|
- name: AutoPSK | Set default path variables for Windows
|
|
ansible.builtin.set_fact:
|
|
zabbix_agent_tlspskfile: "{{ zabbix_win_install_dir }}\\tls_psk_auto.secret.txt"
|
|
zabbix_agent_tlspskidentity_file: "{{ zabbix_win_install_dir }}\\tls_psk_auto.identity.txt"
|
|
tags:
|
|
- config
|
|
|
|
- name: AutoPSK | Check for existing TLS PSK file (Windows)
|
|
ansible.windows.win_stat:
|
|
path: "{{ zabbix_agent_tlspskfile }}"
|
|
register: zabbix_agent_tlspskcheck
|
|
tags:
|
|
- config
|
|
|
|
- name: AutoPSK | Check for existing TLS PSK identity (Windows)
|
|
ansible.windows.win_stat:
|
|
path: "{{ zabbix_agent_tlspskidentity_file }}"
|
|
register: zabbix_agent_tlspskidentity_check
|
|
tags:
|
|
- config
|
|
|
|
- name: AutoPSK | read existing TLS PSK file (Windows)
|
|
ansible.builtin.slurp:
|
|
src: "{{ zabbix_agent_tlspskfile }}"
|
|
register: zabbix_agent_tlspsk_base64
|
|
when:
|
|
- zabbix_agent_tlspskcheck.stat.exists
|
|
no_log: "{{ ansible_verbosity < 3 }}"
|
|
tags:
|
|
- config
|
|
|
|
- name: AutoPSK | Read existing TLS PSK identity file (Windows)
|
|
ansible.builtin.slurp:
|
|
src: "{{ zabbix_agent_tlspskidentity_file }}"
|
|
register: zabbix_agent_tlspskidentity_base64
|
|
when: zabbix_agent_tlspskidentity_check.stat.exists
|
|
no_log: "{{ ansible_verbosity < 3 }}"
|
|
tags:
|
|
- config
|
|
|
|
- include_tasks: tlspsk_auto_common.yml
|
|
|
|
- name: AutoPSK | Template TLS PSK identity in file (Windows)
|
|
ansible.windows.win_copy:
|
|
dest: "{{ zabbix_agent_tlspskidentity_file }}"
|
|
content: "{{ zabbix_agent_tlspskidentity }}"
|
|
when:
|
|
- zabbix_agent_tlspskidentity_file is defined
|
|
- zabbix_agent_tlspskidentity is defined
|
|
notify:
|
|
- restart win zabbix agent
|
|
tags:
|
|
- config
|
|
|
|
- name: AutoPSK | Template TLS PSK secret in file (Windows)
|
|
ansible.windows.win_copy:
|
|
dest: "{{ zabbix_agent_tlspskfile }}"
|
|
content: "{{ zabbix_agent_tlspsk_secret }}"
|
|
when:
|
|
- zabbix_agent_tlspskfile is defined
|
|
- zabbix_agent_tlspsk_secret is defined
|
|
- ansible_os_family == "Windows"
|
|
notify:
|
|
- restart win zabbix agent
|
|
tags:
|
|
- config
|