Skip to content

Instantly share code, notes, and snippets.

Created May 17, 2016 16:27
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 anonymous/a0d657ee745cfa75b0bc6ee502dc7bfb to your computer and use it in GitHub Desktop.
Save anonymous/a0d657ee745cfa75b0bc6ee502dc7bfb to your computer and use it in GitHub Desktop.
{% from "packages/zabbix-agent/map.jinja" import our_ips with context %}
{% from "packages/zabbix-agent/map.jinja" import hostname with context %}
{% from "packages/zabbix-agent/map.jinja" import host_group with context %}
{% from "packages/zabbix-agent/map.jinja" import template_1 with context %}
{% from "packages/zabbix-agent/map.jinja" import template_2 with context %}
zabbix-agent:
pkg.installed:
- name: zabbix-agent
service:
- running
- enable: True
- order: last
zabbix-agent-conf:
file:
- managed
- name: /etc/zabbix/zabbix_agentd.conf
- user: root
- group: zabbix
- source: salt://packages/zabbix-agent/files/etc_zabbix_zabbix_agentd.conf.jinja
- template: jinja
- mode: 640
- require:
- pkg: zabbix-agent
- watch_in:
- service: zabbix-agent
{% if our_ips %}
zabbix-agent-register:
cmd.script:
- source: salt://packages/zabbix-agent/files/zabbix-agent-register.sh
- args: "-l sec1 -h \"{{ hostname }}\" -i \"{{ our_ips[0] }}\" -g \"{{ host_group }}\" -t \"{{ template_1 }}\" -t \"{{ template_2 }}\""
- user: root
- group: root
- shell: /bin/bash
{% endif %}
/var/lib/zabbix/scripts:
file.directory:
- user: zabbix
- group: zabbix
- mode: 755
- makedirs: True
- recurse:
- user
- group
- mode
Data failed to compile:
----------
Rendering SLS packages.zabbix-agent failed, render error: while parsing a block mapping
in "<unicode string>", line 7, column 1:
zabbix-agent:
^
expected <block end>, but found '<block mapping start>'
in "<unicode string>", line 31, column 3:
zabbix-agent-register:
^
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2408, in render_state
sls, rendered_sls=mods
File "/usr/lib/python2.6/site-packages/salt/template.py", line 84, in compile_template
ret = render(input_data, saltenv, sls, **render_kwargs)
File "/usr/lib/python2.6/site-packages/salt/renderers/yaml.py", line 48, in render
data = load(yaml_data, Loader=get_yaml_loader(argline))
File "/usr/lib64/python2.6/site-packages/yaml/__init__.py", line 71, in load
return loader.get_single_data()
File "/usr/lib64/python2.6/site-packages/yaml/constructor.py", line 37, in get_single_data
node = self.get_single_node()
File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 439, in parse_block_mapping_key
"expected <block end>, but found %r" % token.id, token.start_mark)
ParserError: while parsing a block mapping
in "<unicode string>", line 7, column 1:
zabbix-agent:
^
expected <block end>, but found '<block mapping start>'
in "<unicode string>", line 31, column 3:
zabbix-agent-register:
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment