Ad Widget

Collapse

Create a host with snmp interface via api/ansible mudule "zabbix_host"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Create a host with snmp interface via api/ansible mudule "zabbix_host"

    Hello,
    I have a problem creating hosts with ansible (see https://docs.ansible.com/ansible/lat...st_module.html ) when I set the interface type to 2 (snmp). It works fine with the other types. I guess zabbix wants some more details like snmp version and community ( https://www.zabbix.com/documentation...terface/object ). Can anyone help me setting these in my playbook?

    My playbook:
    ---
    - hosts: test
    vars_files:
    - "../vars/zabbix_vars.yml"
    tasks:
    - name: "create host on zabbix server"
    local_action:
    module: zabbix_host
    server_url: "{{ zabbix_server_url }}"
    login_user: "{{ zabbix_user }}"
    login_password: "{{ zabbix_pw }}"
    host_name: test123
    interfaces:
    - type: 2
    ip: 10.0.0.1
    main: 1
    useip: 1
    dns: ""
    status: disabled
    state: present
    host_groups:
    - Networking Hardware
    And here the error:
    fatal: [test_centos8_4]: FAILED! => {"changed": false, "msg": "Failed to create host test123: ('Error -32602: Invalid params., Incorrect arguments passed to function. while sending {"jsonrpc": "2.0", "method": "host.create", "params": {"host": "test123", "interfaces": [{"type": 2, "ip": "10.0.0.1", "main": 1, "useip": 1, "dns": "", "port": "161"}], "groups": [{"groupid": "16"}], "status": 1, "tls_connect": 1, "tls_accept": 1}, "auth": "ebasdadadadasdasdadsadad", "id": 4}', -32602)"}
    Zabbix Server 5.0.0
    ansible 2.9.10
    zabbix-api 0.5.4

Announcement

Collapse
No announcement yet.
Working...
X