Skip to content

Commit

Permalink
Merge pull request #168 from msekania/feature-contacts-groups
Browse files Browse the repository at this point in the history
Feature contacts groups
  • Loading branch information
robin-checkmk committed Nov 18, 2022
2 parents d0216f5 + 708b8a6 commit 66d4d47
Show file tree
Hide file tree
Showing 9 changed files with 867 additions and 1 deletion.
65 changes: 65 additions & 0 deletions .github/workflows/ans-int-test-contact_group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml

name: Ansible Integration Tests for Contact Group Module
on:
workflow_dispatch:
pull_request:
branches:
- main
- devel
paths:
- 'plugins/modules/contact_group.py'

env:
NAMESPACE: tribe29
COLLECTION_NAME: checkmk

jobs:

###
# Integration tests (RECOMMENDED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html

integration:
runs-on: ubuntu-latest
name: Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}
strategy:
fail-fast: false
matrix:
ansible:
- stable-2.12
- stable-2.13
- devel
python:
- '2.7'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
exclude:
# Exclude unsupported sets.
- ansible: stable-2.12
python: '3.11'
- ansible: stable-2.13
python: '3.11'

steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Run integration test
run: ansible-test integration contact_group -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
4 changes: 4 additions & 0 deletions changelogs/fragments/contact_group_module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to

major_changes:
- Add contact_group module.
1 change: 1 addition & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ action_groups:
- rule
- tag_group
- host_group
- contact_group

# plugin_routing:
# modules:
Expand Down
27 changes: 26 additions & 1 deletion playbooks/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
delegate_to: localhost
run_once: 'true'

- name: "Create folders."
- name: "Create folder."
folder:
server_url: "{{ server_url }}"
site: "{{ site }}"
Expand Down Expand Up @@ -98,6 +98,19 @@
state: "present"
delegate_to: localhost

- name: "Create contact groups."
contact_group:
server_url: "{{ server_url }}"
site: "{{ site }}"
automation_user: "{{ automation_user }}"
automation_secret: "{{ automation_secret }}"
name: "{{ item.name }}"
title: "{{ item.title | default(item.name) }}"
state: "present"
delegate_to: localhost
run_once: true
loop: "{{ checkmk_contact_groups_create }}"

- name: "Pause to review second set of changes."
ansible.builtin.pause:
prompt: |
Expand All @@ -116,6 +129,18 @@
delegate_to: localhost
run_once: 'true'

- name: "Delete contact groups."
contact_group:
server_url: "{{ server_url }}"
site: "{{ site }}"
automation_user: "{{ automation_user }}"
automation_secret: "{{ automation_secret }}"
name: "{{ item.name }}"
state: "absent"
delegate_to: localhost
run_once: true
loop: "{{ checkmk_contact_groups_create }}"

- name: "Delete Host."
host:
server_url: "{{ server_url }}"
Expand Down
Loading

0 comments on commit 66d4d47

Please sign in to comment.