-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from T-Systems-MMS/playbooks_for_simplifying_c…
…reate_checks Playbooks for simplifying create checks
- Loading branch information
Showing
13 changed files
with
374 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,13 @@ on: | |
schedule: | ||
- cron: "0 6 * * 1" | ||
|
||
concurrency: | ||
group: >- | ||
${{ github.workflow }}-${{ | ||
github.event.pull_request.number || github.sha | ||
}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ansible-sanity-tests: | ||
name: Sanity (Ⓐ${{ matrix.ansible }}) | ||
|
@@ -40,6 +47,40 @@ jobs: | |
run: ansible-test sanity --docker -v --color | ||
working-directory: ./ansible_collections/t_systems_mms/ansible_collection_icinga | ||
|
||
integration: | ||
runs-on: ubuntu-20.04 | ||
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ansible: | ||
- stable-2.12 | ||
- stable-2.13 | ||
- stable-2.14 | ||
- devel | ||
python: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
services: | ||
icinga: | ||
image: ghcr.io/telekom-mms/icinga2:director-1.8.1 | ||
ports: | ||
- 80:80 | ||
steps: | ||
- name: >- | ||
Perform integration testing against | ||
Ansible version ${{ matrix.ansible }} | ||
under Python ${{ matrix.python }} | ||
uses: ansible-community/[email protected] | ||
with: | ||
ansible-core-version: ${{ matrix.ansible }} | ||
# OPTIONAL command to run before invoking `ansible-test integration` | ||
pre-test-cmd: sed -i "s/127.0.0.1/icinga/g" tests/integration/integration_config.yml | ||
target-python-version: ${{ matrix.python }} | ||
testing-type: integration | ||
test-deps: telekom_mms.icinga_director | ||
linting: | ||
name: Ansible Lint | ||
runs-on: ubuntu-latest | ||
|
@@ -49,12 +90,7 @@ jobs: | |
uses: actions/checkout@v3 | ||
|
||
- name: Run Linting | ||
uses: ansible/ansible-lint-action@v6 | ||
with: | ||
targets: roles/ | ||
override-deps: | | ||
rich>=9.5.1,<11.0.0 | ||
args: "" | ||
uses: ansible/[email protected] | ||
|
||
molecule: | ||
name: Molecule | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
- name: Create command and service template for Azure oauth token | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create command Azure oauth token | ||
telekom_mms.icinga_director.icinga_command: | ||
state: present | ||
object_name: azure_oauth_token | ||
command: "azure_oauth_token.py" | ||
arguments: | ||
(no key): | ||
order: 1 | ||
required: true | ||
skip_key: true | ||
value: $tenant_id$ | ||
(no key.1): | ||
order: 2 | ||
required: true | ||
skip_key: true | ||
value: $client_id$ | ||
(no key.2): | ||
order: 3 | ||
required: true | ||
skip_key: true | ||
value: $client_secret$ | ||
(no key.3): | ||
order: 4 | ||
required: true | ||
skip_key: true | ||
value: $scope$ | ||
- name: Create service template for Azure oauth token | ||
telekom_mms.icinga_director.icinga_service_template: | ||
state: present | ||
object_name: "azure_oauth_token" | ||
check_command: "azure_oauth_token" | ||
check_interval: 50m |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
- name: Create command and service template for check_gitlab_scheduler | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create command for check_gitlab_scheduler | ||
telekom_mms.icinga_director.icinga_command: | ||
state: present | ||
object_name: check_gitlab_scheduler | ||
command: check_gitlab_scheduler.py | ||
arguments: | ||
-p: | ||
required: true | ||
value: $projectid$ | ||
-s: | ||
required: true | ||
value: $schedulerid$ | ||
-t: | ||
required: true | ||
value: $token$ | ||
-o: | ||
required: false | ||
value: $pending_timeout$ | ||
- name: Create service template for check_gitlab_scheduler | ||
telekom_mms.icinga_director.icinga_service_template: | ||
state: present | ||
object_name: check_gitlab_scheduler | ||
check_command: "check_gitlab_scheduler" | ||
check_interval: 5m |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- name: Create service templates for defaults | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create service template for mms-https | ||
telekom_mms.icinga_director.icinga_service_template: | ||
state: present | ||
object_name: mms-https | ||
imports: | ||
- mms-standard-service | ||
check_command: http | ||
check_interval: 300 | ||
vars: | ||
http_address: $check_address$ | ||
http_extendedperfdata: false | ||
http_invertregex: false | ||
http_sni: true | ||
http_ssl: true | ||
http_timeout: 30 | ||
|
||
- name: Create service template for mms-https | ||
telekom_mms.icinga_director.icinga_service_template: | ||
state: present | ||
object_name: mms-https-certificate | ||
imports: | ||
- mms-https | ||
check_timeout: 60 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
- name: Create service template and command for check_json | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create Command check_json | ||
telekom_mms.icinga_director.icinga_command: | ||
state: present | ||
object_name: check_json | ||
command: "check_json.pl" | ||
arguments: | ||
--ignoressl: | ||
set_if: $json_ignoressl$ | ||
-T: $json_contenttype$ | ||
-a: | ||
required: true | ||
value: $json_attributes$ | ||
-b: | ||
value: $json_bearer$ | ||
-c: | ||
required: true | ||
type: Function | ||
body: macro("$json_crit$") | ||
-d: $json_divisor$ | ||
-e: $json_expect$ | ||
-m: $json_metadata$ | ||
-o: $json_outputvars$ | ||
-p: $json_perfvars$ | ||
-t: $json_timeout$ | ||
-u: | ||
required: true | ||
value: $json_url$ | ||
-w: | ||
required: true | ||
type: Function | ||
body: macro("$json_warn$") | ||
-x: $json_xauth$ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
- name: Create service template for mms-standard-service and azure REST-API | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create command Azure REST-API | ||
telekom_mms.icinga_director.icinga_command: | ||
state: present | ||
object_name: check_json_azure_restapi | ||
command: check_json.pl | ||
arguments: | ||
--ignoressl: | ||
set_if: $json_ignoressl$ | ||
-T: $json_contenttype$ | ||
-a: | ||
required: true | ||
value: $json_attributes$ | ||
-b: | ||
required: true | ||
type: Function | ||
body: return get_service(macro("$azure_oauth_token_host$"), macro("$azure_oauth_token_service$")).last_check_result.output | ||
-c: | ||
required: true | ||
type: Function | ||
body: macro("$json_crit$") | ||
-d: $json_divisor$ | ||
-e: $json_expect$ | ||
-m: $json_metadata$ | ||
-o: $json_outputvars$ | ||
-p: $json_perfvars$ | ||
-t: $json_timeout$ | ||
-u: | ||
required: true | ||
value: $json_url$ | ||
-w: | ||
required: true | ||
type: Function | ||
body: macro("$json_warn$") | ||
-x: $json_xauth$ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Create service template for azure REST-API ResourceHealth | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create service template for azure REST-API ResourceHealth | ||
telekom_mms.icinga_director.icinga_service_template: | ||
state: present | ||
object_name: mms-json-azure_restapi_resourcehealth | ||
imports: | ||
- mms-standard-service | ||
check_command: check_json_azure_restapi | ||
check_interval: 5m | ||
vars: | ||
json_url: | ||
"https://management.azure.com/subscriptions/$azure_subscription_id$/resourcegroups/$azure_resource_group$$azure_resource_uri$/\ | ||
providers/Microsoft.ResourceHealth/availabilityStatuses/current?api-version=2020-05-01-preview" | ||
json_expect: Available | ||
json_ignoressl: true | ||
json_attributes: "{properties}->{availabilityState}" | ||
json_outputvars: "{properties}->{availabilityState},{properties}->{summary},{properties}->{reasonType},{properties}->{occuredTime}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
- name: Create mms-standards | ||
hosts: localhost | ||
gather_facts: false | ||
module_defaults: | ||
group/telekom_mms.icinga_director.icinga: | ||
url: "{{ icinga_url }}" | ||
url_username: "{{ icinga_user }}" | ||
url_password: "{{ icinga_pass }}" | ||
tasks: | ||
- name: Create timeperiod for mms-standard-service | ||
telekom_mms.icinga_director.icinga_timeperiod: | ||
state: present | ||
object_name: 24/7 | ||
ranges: | ||
monday: "00:00-24:00" | ||
tuesday: "00:00-24:00" | ||
wednesday: "00:00-24:00" | ||
thursday: "00:00-24:00" | ||
friday: "00:00-24:00" | ||
saturday: "00:00-24:00" | ||
sunday: "00:00-24:00" | ||
|
||
- name: Create service template for mms-standard-service | ||
telekom_mms.icinga_director.icinga_service_template: | ||
state: present | ||
object_name: mms-standard-service | ||
max_check_attempts: "3" | ||
check_period: "24/7" | ||
check_interval: "2m" | ||
retry_interval: "1m" | ||
enable_notifications: true | ||
enable_active_checks: true | ||
enable_passive_checks: false | ||
enable_event_handler: false | ||
enable_perfdata: true | ||
volatile: false |
Oops, something went wrong.