guillaumewatteeux / ansible-centreon

Ansible modules for CLAPI REST (Centreon API)
GNU General Public License v3.0
10 stars 12 forks source link

add a single macro #2

Closed kermith72 closed 5 years ago

kermith72 commented 6 years ago

when I add a macro to a host, it is not added

` exemple code

tasks: 
- name: Add host to Centreon
  centreon_host:
    url: "{{ centreon_url }}"
    username: "{{ centreon_api_user }}"
    password: "{{ centreon_api_pass }}"
    name: "Server"
    alias: "Server Monitoring"
    ipaddr: "127.0.0.1"
    hostgroups:
      - Linux-Server
    hosttemplates:
      - OS-Linux-SNMP-custom
      - App-DB-MySQL
    macros:
      - name: MACRO1
         value: value1
    instance: Central
    status: enabled
    state: present
    applycfg: False
  delegate_to: localhost`

it works with several macros

guillaumewatteeux commented 6 years ago

Hi @kermith72,

Could you retry with quoted value ?

macros:
  - name: "MACRO1"
     value: "value1"

On my production env, I use this code to add a macros.

- role: centreon
     centreon_host_macros:
       - name: "MATTERMOST_CHAN"
          value: "{{ _centreon_notification_mattermost_chan }}"

And code: https://github.com/guillaumewatteeux/ansible-role-centreon/blob/532db51d115598ecd72b92b076d308e11fce6f52/tasks/main.yml#L29

guillaumewatteeux commented 5 years ago

Fix on dev branch