Skip to content

Instantly share code, notes, and snippets.

@richlv
Last active January 3, 2019 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlv/852cd74f55f6f189134ee5370d338036 to your computer and use it in GitHub Desktop.
Save richlv/852cd74f55f6f189134ee5370d338036 to your computer and use it in GitHub Desktop.
===== Variables:
action_common_keys:
server_url: "http://localhost/"
login_user: api_cli
login_password: "{{api_cli_password}}"
state: present
status: enabled
actions_discovery:
- name: "Send alerts to Admin"
event_source: 'trigger'
conditions:
- type: 'trigger_severity'
operator: '>='
value: 'Information'
===== Task:
- name: Add Zabbix discovery actions
zabbix_action:
"{{ {{action_common_keys}} | combine({{item}}) }}"
loop: "{{actions_discovery}}"
===== Error
template error while templating string: expected token ':', got '}'. String: {{ {{action_common_keys}} | combine({{item}}) }}
===== Solution
Use module_defaults instead: https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment