Icinga2 silent client setup

Hello,

I’m trying to automate Icinga2 node setup,
Is there any way to define more than one parent_host?

According to this instructions, I tried to set it up this way:

icinga2 node setup \
--cn client \
--endpoint master \
--zone client5 \
--parent_zone satellites-zone \
--**parent_host [satellite-2, satellite-1]** \
--trustedcert /var/lib/icinga2/certs/trusted-parent.crt \
--accept-commands --accept-config \
--disable-confd

But its not working.
‘–parent_host’ cannot be specified more than once

Am I mistaken in syntax, or it is impossible?

Icinga2 version is r2.9.0-1

Thanks in advance!

Yo only can specify one parent Host, thats why iam using Business processen for HA environments.

i do follow this…

I’m afraid, you’re mixing things up.

The parent from the wizard is the parent zone from zones and endpoints for communication between Icinga instances.

The parent where you can have only one (which is not competely correct, too) which you can workaround with business processes is host depdencies which is something completely different.

parent_host is the host where you connect to for CSR autosigning, this can only be one. The parameter you are looking for is endpoint to render this in the configuration.

@dnsmichi @widhalmt :wink: make it more easy to use and add client

Thank you, Michael, it is exactly what I tried to find!

Unfortunately I still can not make zones.conf look like after wizard, like this:


object Endpoint “satellite-1” {
host = “satellite-1”
port = “5665”
}

object Endpoint “satellite-2” {
host = “satellite-2”
port = “5665”
}

object Zone “satellite” {
endpoints = [ “satellite-1”, “satellite-2” ]
}

Instead of it, if I’m trying to use

icinga2 node setup <...> --endpoint ["satellite-1","satellite-2"] <...>

That what I receiving in zones.conf:

object Endpoint “[satellite-2” {
host = “satellite-1]”
}

object Zone “satellites-zone” {
endpoints = [ “[satellite-2” ]
}

With or without square brackets, it didn’t worked for me…
What is the right syntax?

(If I didnt managed to explain myself - I want provide answer “yes” to wizard question “Add more master/satellite endpoints? [y/N]:”, but in “silent”, automated setup)

--endpoint can be passed multiple times on the command line as key value items.

--endpoint satellite1,host,port --endpoint satellite2,host,port

Thank you,
Worked perfectly!

@Simon
could you Show a example how you silent connect the Client to the master, please?
and what did you Need to do on the master?
have a nice day
vinc

I’m trying to write an ansible playbook to set up the client, here the draft of the tasks:

- name: Getting client hostname
  shell: hostname
  register: hostname
- name: Generating ticket
  shell: icinga2 pki ticket --cn "{{ hostname.stdout }}"
  register: ticket
  delegate_to: 192.168.1.10 //master example IP
- name: Generating new certificate
- name: Running node setup
  shell: |
          icinga2 node setup --ticket "{{ ticket.stdout }}" \
          --cn "{{ hostname.stdout }}" \
          --endpoint satellite1,192.168.0.1,5665 \
          --endpoint satellite2,192.168.0.2,5665 \
          --zone "{{ hostname.stdout }}" \
          --accept-commands --accept-config \
          --disable-confd

IP’s of master and satellites are variables in my case as well.
I hope it will work.

2 Likes