Last active
August 31, 2022 15:51
-
-
Save robin-checkmk/0c9fe32edcfe0ce545b2e25bc4f40279 to your computer and use it in GitHub Desktop.
cc.yml from the Community Call about the Checkmk Ansible collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: "Community Call - Roles." | |
hosts: localhost | |
gather_facts: true | |
vars_files: | |
- ./vars/config.yml | |
tasks: | |
- name: "Run server role." | |
ansible.builtin.import_role: | |
name: tribe29.checkmk.server | |
- name: "Run agent role." | |
ansible.builtin.import_role: | |
name: tribe29.checkmk.agent | |
- name: "Activate changes." | |
tribe29.checkmk.activation: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
force_foreign_changes: true | |
sites: | |
- "{{ site }}" | |
delegate_to: localhost | |
run_once: true | |
- name: "Pause." | |
ansible.builtin.pause: | |
prompt: | | |
"Press <Enter> to continue." | |
- name: "Community Call - Modules." | |
hosts: test | |
gather_facts: false | |
vars_files: | |
- ./vars/config.yml | |
tasks: | |
- name: "Create folders." | |
tribe29.checkmk.folder: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
path: "{{ item.path }}" | |
title: "{{ item.title }}" | |
state: "present" | |
delegate_to: localhost | |
run_once: true | |
loop: "{{ checkmk_folders }}" | |
- name: "Create host." | |
tribe29.checkmk.host: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
host_name: "{{ inventory_hostname }}" | |
folder: "{{ checkmk_folder_path }}" | |
attributes: | |
site: "{{ site }}" | |
ipaddress: 127.0.0.1 | |
state: "present" | |
delegate_to: localhost | |
- name: "Discover services on host." | |
tribe29.checkmk.discovery: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
host_name: "{{ inventory_hostname }}" | |
state: "fix_all" | |
delegate_to: localhost | |
- name: "Activate changes on site - Showcase creation of hosts and folders." | |
tribe29.checkmk.activation: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
force_foreign_changes: true | |
sites: | |
- "{{ site }}" | |
delegate_to: localhost | |
run_once: true | |
- name: "Schedule Downtime - On Hosts with absolute Timestamps." | |
tribe29.checkmk.downtime: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
host_name: "{{ inventory_hostname }}" | |
comment: "Ansible Collection saying Hi" | |
start_time: 2023-08-31T20:00:00Z | |
end_time: 2023-08-31T22:00:00Z | |
delegate_to: localhost | |
- name: "Pause." | |
ansible.builtin.pause: | |
prompt: | | |
"Press <Enter> to continue." | |
- name: "Delete Host." | |
tribe29.checkmk.host: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
host_name: "{{ inventory_hostname }}" | |
folder: "{{ checkmk_folder_path }}" | |
state: "absent" | |
delegate_to: localhost | |
when: not inventory_hostname == "localhost" | |
- name: "Delete folders." | |
tribe29.checkmk.folder: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
path: "{{ item.path }}" | |
title: "{{ item.title }}" | |
state: "absent" | |
register: testout | |
delegate_to: localhost | |
run_once: true | |
loop: "{{ checkmk_folders }}" | |
- name: "Activate changes on site - Showcase host and folders were deleted" | |
tribe29.checkmk.activation: | |
server_url: "{{ server_url }}" | |
site: "{{ site }}" | |
automation_user: "{{ automation_user }}" | |
automation_secret: "{{ automation_secret }}" | |
force_foreign_changes: true | |
sites: | |
- "{{ site }}" | |
delegate_to: localhost | |
run_once: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
server_url: "http://localhost/" | |
site: "local" | |
automation_user: "cmkadmin" | |
automation_secret: "cmkadmin" | |
checkmk_folders: | |
- path: /test | |
title: Test | |
- path: /foo | |
title: Foo | |
- path: /bar | |
title: Bar | |
checkmk_version: "2.1.0p11" | |
checkmk_edition: "cre" | |
# Agent role | |
checkmk_agent_version: "{{ checkmk_version }}" | |
checkmk_agent_edition: "{{ checkmk_edition }}" | |
checkmk_agent_protocol: http | |
checkmk_agent_server: localhost | |
checkmk_agent_site: "{{ site }}" | |
checkmk_agent_user: "{{ automation_user | default('automation') }}" | |
checkmk_agent_pass: "{{ automation_secret }}" | |
checkmk_agent_update: 'false' | |
checkmk_agent_tls: 'false' | |
checkmk_agent_add_host: 'true' | |
checkmk_agent_discover: 'true' | |
checkmk_agent_host_name: "{{ inventory_hostname }}" | |
checkmk_agent_host_attributes: | |
ipaddress: "{{ checkmk_agent_host_ip | default(omit) }}" | |
tag_agent: 'cmk-agent' | |
# Server Role | |
checkmk_server_edition: "{{ checkmk_edition }}" | |
checkmk_server_version: "{{ checkmk_version }}" | |
checkmk_server_verify_setup: 'true' | |
checkmk_server_sites: | |
- name: "{{ site }}" | |
version: "{{ checkmk_server_version }}" | |
state: started | |
admin_pw: cmkadmin | |
update_conflict_resolution: install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment