Closed jessequinn closed 3 years ago
Thanks for opening this issue @jessequinn .
For the completeness, below is my testing playbook. I've tried to mirror what you wrote as closely as possible:
- hosts: localhost
vars:
autoregitems:
- name: Auto register hosts
hostgroup:
- Linux servers
templates:
- Template OS Linux by Zabbix agent
host_metadata: "meta"
- name: Auto register hosts 2
hostgroup:
- Zabbix servers
templates:
- Template OS Linux by Zabbix agent
host_metadata: "meta2"
tasks:
- name: Create auto registration action
local_action:
module: zabbix_action
server_url: "http://localhost:8080/"
validate_certs: no
login_user: "Admin"
login_password: "zabbix"
name: "{{ auto_registration_item.name }}"
event_source: "auto_registration"
state: present
status: enabled
esc_period: "60"
conditions:
- type: "host_metadata"
operator: "like"
value: "{{ auto_registration_item.host_metadata }}"
formulaid: A
formula: A
operations:
- type: add_host
- type: add_to_host_group
host_groups: "{{ auto_registration_item.hostgroup }}"
- type: link_to_template
templates: "{{ auto_registration_item.templates }}"
timeout: 60
loop: '{{ autoregitems }}'
loop_control:
loop_var: auto_registration_item
My observations:
Can you please confirm that my testing playbook isn't that far off from what are you trying to do? Also can you please test if this also works correctly for you with ansible 2.10 if possible? I am pretty sure there have been some changes to the zabbix_action
module that got rejected from 2.9 as ansible transitioned to the 2.10, hence the difference in behavior.
@D3DeFi looks about right. i think the killer is just make sure you run against several servers. But i am wondering if is it an issue directly related to templates. if a template uses a marco, that could change, would alter the state?
@D3DeFi looks about right. i think the killer is just make sure you run against several servers. But i am wondering if is it an issue directly related to templates. if a template uses a marco, that could change, would alter the state?
Sorry for a delayed response. I don't think that macro value can change whole template from the perspective of ansible unless it is the template itself that is defining a macro (or rather a default value for macro).
Anyway, are you still hitting this problems even with community.zabbix:1.2.0?
issue dormant, solution offered, please feel free to reopen if you are still experiencing this as there was no response for more than half a year now
SUMMARY
Using the zabbix_action to add an auto-registration action always shows changed.
ISSUE TYPE
COMPONENT NAME
zabbix_action v1.0.0
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
Zabbix Web/Server 5.0.4
STEPS TO REPRODUCE
EXPECTED RESULTS
As the items already exist from running the ansible script. I expect the state to show
OK
.ACTUAL RESULTS
First item in loop appears with
OK
all subsequent items showchanged
: vvvv output minus some client related info. Again. all auto-registration actions already exist. If i comment out the first item all zabbix_actions showchanged
.