mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-26 18:37:21 +00:00
reworked to register hosts for TLS with the server
This commit is contained in:
1 parent
f6d1fa267f
commit
001db69fe0
1 file changed
+76
-38
@@ -1,4 +1,72 @@
|
||||
---
|
||||
- name: CheckMK Hosts
|
||||
hosts: "meta-win_project_{{ win_project }}:&meta-os_windows"
|
||||
gather_facts: false
|
||||
vars_files:
|
||||
- ../vars/checkmk.yml
|
||||
- ../vars/common.yml
|
||||
tasks:
|
||||
- name: "Create folder for eidf project"
|
||||
checkmk.general.folder:
|
||||
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
|
||||
site: "{{ checkmk_agent_site }}"
|
||||
automation_user: "{{ checkmk_agent_user }}"
|
||||
automation_secret: "{{ checkmk_password }}"
|
||||
path: "/{{ os_project }}-{{ win_project }}"
|
||||
name: "{{ os_project }}-{{ win_project }}"
|
||||
state: "{{ state }}" # might need to create hosts them move so teardown works??? or leave folder after teardown or add only teardown task after
|
||||
run_once: true
|
||||
delegate_to: "localhost"
|
||||
tags:
|
||||
- checkmk_host
|
||||
- checkmk_all
|
||||
|
||||
- name: Add Windows host into check
|
||||
checkmk.general.host:
|
||||
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
|
||||
site: "{{ checkmk_agent_site }}"
|
||||
validate_certs: "true"
|
||||
automation_user: "{{ checkmk_agent_user }}"
|
||||
automation_secret: "{{ checkmk_password }}"
|
||||
folder: "/{{ os_project }}-{{ win_project }}"
|
||||
name: "{{ inventory_hostname }}"
|
||||
attributes:
|
||||
ipaddress: "{{ hostvars[inventory_hostname].ansible_host }}"
|
||||
state: "{{ state }}"
|
||||
delegate_to: "localhost"
|
||||
notify: "activate changes"
|
||||
tags:
|
||||
- checkmk_host
|
||||
- checkmk_all
|
||||
|
||||
- name: "Create folder for eidf project"
|
||||
checkmk.general.folder:
|
||||
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
|
||||
site: "{{ checkmk_agent_site }}"
|
||||
automation_user: "{{ checkmk_agent_user }}"
|
||||
automation_secret: "{{ checkmk_password }}"
|
||||
path: "/{{ os_project }}-{{ win_project }}"
|
||||
name: "{{ os_project }}-{{ win_project }}"
|
||||
state: "{{ state }}" # might need to create hosts them move so teardown works??? or leave folder after teardown or add only teardown task after
|
||||
run_once: true
|
||||
notify: "activate changes"
|
||||
delegate_to: "localhost"
|
||||
tags:
|
||||
- teardown
|
||||
|
||||
handlers:
|
||||
- name: "Activate Changes"
|
||||
listen: activate changes
|
||||
checkmk.general.activation:
|
||||
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
|
||||
site: "{{ checkmk_agent_site }}"
|
||||
automation_user: "{{ checkmk_agent_user }}"
|
||||
automation_secret: "{{ checkmk_password }}"
|
||||
force_foreign_changes: "false"
|
||||
validate_certs: "true"
|
||||
delegate_to: "localhost"
|
||||
run_once: true
|
||||
|
||||
- name: CheckMK Agent
|
||||
hosts: "meta-win_project_{{ win_project }}:&meta-os_windows"
|
||||
gather_facts: false
|
||||
@@ -24,41 +92,11 @@
|
||||
- checkmk_all
|
||||
- checkmk_agent
|
||||
|
||||
- name: CheckMK Hosts
|
||||
hosts: "meta-win_project_{{ win_project }}:&meta-os_windows"
|
||||
gather_facts: false
|
||||
vars_files:
|
||||
- ../vars/checkmk.yml
|
||||
- ../vars/common.yml
|
||||
tasks:
|
||||
- name: Add Windows host into check
|
||||
checkmk.general.host:
|
||||
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
|
||||
site: "{{ checkmk_agent_site }}"
|
||||
validate_certs: "true"
|
||||
automation_user: "{{ checkmk_agent_user }}"
|
||||
automation_secret: "{{ checkmk_password }}"
|
||||
folder: "/"
|
||||
name: "{{ inventory_hostname }}"
|
||||
attributes:
|
||||
ipaddress: "{{ hostvars[inventory_hostname].ansible_host }}"
|
||||
state: "{{ state }}"
|
||||
delegate_to: "localhost"
|
||||
notify: "activate changes"
|
||||
tags:
|
||||
- checkmk_host
|
||||
- checkmk_all
|
||||
- teardown
|
||||
|
||||
handlers:
|
||||
- name: "Activate Changes"
|
||||
listen: activate changes
|
||||
checkmk.general.activation:
|
||||
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
|
||||
site: "{{ checkmk_agent_site }}"
|
||||
automation_user: "{{ checkmk_agent_user }}"
|
||||
automation_secret: "{{ checkmk_password }}"
|
||||
force_foreign_changes: "false"
|
||||
validate_certs: "true"
|
||||
delegate_to: "localhost"
|
||||
run_once: true
|
||||
- name: register for TLS
|
||||
win_shell: |
|
||||
sl 'C:\Program Files (x86)\checkmk\service'
|
||||
.\cmk-agent-ctl register --hostname {{ inventory_hostname }} --server {{ checkmk_server }} --site {{ checkmk_agent_site }} --user {{ checkmk_agent_user }} --password '{{ checkmk_password }}' --trust-cert
|
||||
tags:
|
||||
- checkmk_host
|
||||
- checkmk_tls
|
||||
- checkmk_all
|
||||
Reference in new issue
Block a user