diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f62fa69..436df797 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,82 +86,179 @@ jobs: ${{ contains(fromJson( '["stable-2.9", "stable-2.10", "stable-2.11"]' ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }} - name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) + name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) - director ${{ matrix.icinga_director }} strategy: fail-fast: false matrix: + icinga_director: + - 1.8.1 + - 1.11.0 ansible: - devel # - milestone python: - - '2.7' - - '3.6' - '3.7' - '3.8' - '3.9' - '3.10' - '3.11' - exclude: - - ansible: devel - python: '2.7' - - ansible: devel - python: '3.6' + - '3.12' include: # Add new versions announced in # https://github.com/ansible-collections/news-for-maintainers in a timely manner, # consider dropping testing against EOL versions and versions you don't support. - # ansible-core 2.13 - - ansible: stable-2.13 + # ansible-core 2.14 + - ansible: stable-2.14 python: '2.7' - - ansible: stable-2.13 + icinga_director: 1.8.1 + - ansible: stable-2.14 python: '3.5' - - ansible: stable-2.13 + icinga_director: 1.8.1 + - ansible: stable-2.14 python: '3.6' - - ansible: stable-2.13 + icinga_director: 1.8.1 + - ansible: stable-2.14 python: '3.7' - - ansible: stable-2.13 + icinga_director: 1.8.1 + - ansible: stable-2.14 python: '3.8' - - ansible: stable-2.13 + icinga_director: 1.8.1 + - ansible: stable-2.14 python: '3.9' - - ansible: stable-2.13 + icinga_director: 1.8.1 + - ansible: stable-2.14 python: '3.10' - # ansible-core 2.14 + icinga_director: 1.8.1 + - ansible: stable-2.14 + python: '3.11' + icinga_director: 1.8.1 + # ansible-core 2.15 + - ansible: stable-2.15 + python: '2.7' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.5' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.6' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.7' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.8' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.9' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.10' + icinga_director: 1.8.1 + - ansible: stable-2.15 + python: '3.11' + icinga_director: 1.8.1 + # ansible-core 2.16 + - ansible: stable-2.16 + python: '2.7' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.6' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.7' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.8' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.9' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.10' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.11' + icinga_director: 1.8.1 + - ansible: stable-2.16 + python: '3.12' + icinga_director: 1.8.1 - ansible: stable-2.14 python: '2.7' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.5' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.6' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.7' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.8' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.9' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.10' + icinga_director: 1.11.0 - ansible: stable-2.14 python: '3.11' + icinga_director: 1.11.0 # ansible-core 2.15 - ansible: stable-2.15 python: '2.7' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.5' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.6' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.7' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.8' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.9' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.10' + icinga_director: 1.11.0 - ansible: stable-2.15 python: '3.11' + icinga_director: 1.11.0 + # ansible-core 2.16 + - ansible: stable-2.16 + python: '2.7' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.6' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.7' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.8' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.9' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.10' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.11' + icinga_director: 1.11.0 + - ansible: stable-2.16 + python: '3.12' + icinga_director: 1.11.0 services: icinga: - image: ghcr.io/telekom-mms/icinga2:director-1.8.1@sha256:bf9205d41607f1641146e870644af0529338d06a9b360737bdf56a3f951cc28b + image: ghcr.io/telekom-mms/icinga2:director-${{ matrix.icinga_director }} ports: - 80:80 steps: diff --git a/plugins/modules/icinga_service_apply.py b/plugins/modules/icinga_service_apply.py index e5b5cba2..7ee8a7a5 100644 --- a/plugins/modules/icinga_service_apply.py +++ b/plugins/modules/icinga_service_apply.py @@ -251,6 +251,8 @@ # Icinga2 API class # class ServiceApplyRule(Icinga2APIObject): + find_by_parameter = None + def __init__(self, module, data): path = "/service" super(ServiceApplyRule, self).__init__(module, path, data) @@ -260,18 +262,22 @@ def exists(self): if ret["code"] == 200: for existing_rule in ret["data"]["objects"]: if existing_rule["object_name"] == self.data["object_name"]: - self.object_id = existing_rule["id"] + if "uuid" in existing_rule and existing_rule["uuid"] is not None: + self.find_by_parameter = "uuid" + else: + self.find_by_parameter = "id" + self.object_id = existing_rule[self.find_by_parameter] return self.object_id return False def delete(self): - return super(ServiceApplyRule, self).delete(find_by="id") + return super(ServiceApplyRule, self).delete(find_by=self.find_by_parameter) def modify(self): - return super(ServiceApplyRule, self).modify(find_by="id") + return super(ServiceApplyRule, self).modify(find_by=self.find_by_parameter) def diff(self): - return super(ServiceApplyRule, self).diff(find_by="id") + return super(ServiceApplyRule, self).diff(find_by=self.find_by_parameter) # ===========================================