Skip to content

Different var syntax #310

@tn-mm

Description

@tn-mm

Hi,

I want to create an object file like this:

apply Service for (hdisk => config in host.vars.disks)  {
  import "generic-service"

  check_command = "disk"
  command_endpoint = host.name
  **vars += config**
  vars.disk_wfree = "10%"
  vars.disk_cfree = "5%"
  assign where "config.disk"
}

I think its not possible, or does anybody knows a way?

icinga2_var:
  domain.de:
    - name: disk
      type: Service
      imports:
        - generic-service
      apply: true
      apply_for: hdisk => config in host.vars.disks
      file: 'zones.d/global-templates/services.conf'
      check_command: disk
      command_endpoint: host.name
      vars:
        - disk_wfree: "10%"
        - disk_cfree: "5%"
      assign: config.disk

Edit: Better readability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions