^^^^^^^^^^^^^ | ^^^^^^^^^^^^^ | ||||
Installs and configures the syslog_ng package. | Installs and configures the syslog_ng package. | ||||
``syslog_ng.packages`` | |||||
``syslog_ng.package`` | |||||
^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^ | ||||
Installs the syslog_ng package and optional packages which may provide additional functionalities. | Installs the syslog_ng package and optional packages which may provide additional functionalities. | ||||
^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^ | ||||
This state manages the file ``syslog_ng.conf`` under ``/etc/syslog-ng`` (template found in "syslog_ng/files"). The configuration is populated by values in "syslog_ng/map.jinja" based on the package's default values (and RedHat, Debian, Suse and Arch family distribution specific values), which can then be overridden by values of the same name in pillar. | This state manages the file ``syslog_ng.conf`` under ``/etc/syslog-ng`` (template found in "syslog_ng/files"). The configuration is populated by values in "syslog_ng/map.jinja" based on the package's default values (and RedHat, Debian, Suse and Arch family distribution specific values), which can then be overridden by values of the same name in pillar. | ||||
``syslog_ng.service`` | |||||
^^^^^^^^^^^^^^^^^^^^ | |||||
Manages the startup and running state of the syslog_ng service. | |||||
Testing | Testing | ||||
------- | ------- | ||||
$ gem install bundler | $ gem install bundler | ||||
$ bundle install | $ bundle install | ||||
$ bundle exec kitchen test [platform] | |||||
$ bin/kitchen test [platform] | |||||
Where ``[platform]`` is the platform name defined in ``kitchen.yml``, | Where ``[platform]`` is the platform name defined in ``kitchen.yml``, | ||||
e.g. ``debian-9-2019-2-py3``. | e.g. ``debian-9-2019-2-py3``. | ||||
``kitchen converge`` | |||||
^^^^^^^^^^^^^^^^^^^^ | |||||
``bin/kitchen converge`` | |||||
^^^^^^^^^^^^^^^^^^^^^^^^ | |||||
Creates the docker instance and runs the ``template`` main state, ready for testing. | |||||
Creates the docker instance and runs the ``syslog_ng`` main state, ready for testing. | |||||
``kitchen verify`` | |||||
^^^^^^^^^^^^^^^^^^ | |||||
``bin/kitchen verify`` | |||||
^^^^^^^^^^^^^^^^^^^^^^ | |||||
Runs the ``inspec`` tests on the actual instance. | Runs the ``inspec`` tests on the actual instance. | ||||
``kitchen destroy`` | |||||
^^^^^^^^^^^^^^^^^^^ | |||||
``bin/kitchen destroy`` | |||||
^^^^^^^^^^^^^^^^^^^^^^^ | |||||
Removes the docker instance. | Removes the docker instance. | ||||
``kitchen test`` | |||||
^^^^^^^^^^^^^^^^ | |||||
``bin/kitchen test`` | |||||
^^^^^^^^^^^^^^^^^^^^ | |||||
Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``. | Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``. | ||||
``kitchen login`` | |||||
^^^^^^^^^^^^^^^^^ | |||||
``bin/kitchen login`` | |||||
^^^^^^^^^^^^^^^^^^^^^ | |||||
Gives you SSH access to the instance for manual testing. | Gives you SSH access to the instance for manual testing. |
state_top: | state_top: | ||||
base: | base: | ||||
'*': | '*': | ||||
- syslog_ng.config | |||||
- syslog_ng | |||||
pillars: | pillars: | ||||
top.sls: | top.sls: | ||||
base: | base: |
{% from "syslog_ng/map.jinja" import syslog_ng with context %} | |||||
include: | |||||
- syslog_ng | |||||
syslog_ng.conf: | |||||
file.managed: | |||||
- name: {{ syslog_ng.syslog_ng_config }} | |||||
- source: {{ syslog_ng.syslog_ng_config_src }} | |||||
- template: jinja | |||||
- user: root | |||||
- group: root | |||||
- mode: 644 | |||||
- watch_in: | |||||
- service: syslog_ng |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
{#- Get the `tplroot` from `tpldir` #} | |||||
{%- set tplroot = tpldir.split('/')[0] %} | |||||
{%- set sls_package_install = tplroot ~ '.package.install' %} | |||||
{%- from tplroot ~ "/map.jinja" import syslog_ng with context %} | |||||
include: | |||||
- {{ sls_package_install }} | |||||
syslog_ng/config/install: | |||||
file.managed: | |||||
- name: {{ syslog_ng.syslog_ng_config }} | |||||
- source: {{ syslog_ng.syslog_ng_config_src }} | |||||
- template: jinja | |||||
- user: root | |||||
- group: root | |||||
- mode: 644 | |||||
- require: | |||||
- sls: {{ sls_package_install }} | |||||
- context: | |||||
syslog_ng: {{ syslog_ng | json }} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
include: | |||||
- .file |
{%- from "syslog_ng/macro.jinja" import rule_builder -%} | |||||
{%- from "syslog_ng/map.jinja" import syslog_ng with context -%} | |||||
######################################################################## | |||||
# File managed by Salt at <{{ source }}>. | |||||
# Your changes will be overwritten. | |||||
######################################################################## | |||||
{%- from "syslog_ng/macro.jinja" import rule_builder %} | |||||
@version: {{ syslog_ng.get('version', '3.3') }} | @version: {{ syslog_ng.get('version', '3.3') }} | ||||
{% from "syslog_ng/map.jinja" import syslog_ng with context %} | |||||
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
syslog_ng: | |||||
pkg.installed: | |||||
- name: {{ syslog_ng.package }} | |||||
service.running: | |||||
- enable: True | |||||
- name: {{ syslog_ng.service }} | |||||
- watch: | |||||
- pkg: syslog_ng | |||||
include: | |||||
- .package | |||||
- .config | |||||
- .service |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
include: | |||||
- .install |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
{#- Get the `tplroot` from `tpldir` #} | |||||
{%- set tplroot = tpldir.split('/')[0] %} | |||||
{%- from tplroot ~ "/map.jinja" import syslog_ng with context %} | |||||
syslog_ng/package/install: | |||||
pkg.installed: | |||||
- name: {{ syslog_ng.package }} | |||||
{%- if syslog_ng.packages is defined and syslog_ng.packages %} | |||||
syslog_ng/packages/install: | |||||
pkg.installed: | |||||
- pkgs: | |||||
{%- for pkg in syslog_ng.packages %} | |||||
- {{ pkg.name }}{% if pkg.version is defined and pkg.version %}: '{{ pkg.version }}' {% endif %} | |||||
{%- endfor %} | |||||
{%- endif %} |
{% from "syslog_ng/map.jinja" import syslog_ng with context %} | |||||
include: | |||||
- syslog_ng | |||||
{%- if syslog_ng.packages is defined and syslog_ng.packages %} | |||||
syslog_ng_packages: | |||||
pkg.installed: | |||||
- pkgs: | |||||
{%- for pkg in syslog_ng.packages %} | |||||
- {{ pkg.name }}{% if pkg.version is defined and pkg.version %}: '{{ pkg.version }}' {% endif %} | |||||
{%- endfor %} | |||||
- watch_in: | |||||
- service: syslog_ng | |||||
{%- endif %} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
include: | |||||
- .running |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
{#- Get the `tplroot` from `tpldir` #} | |||||
{%- set tplroot = tpldir.split('/')[0] %} | |||||
{%- set sls_config_file = tplroot ~ '.config.file' %} | |||||
{%- from tplroot ~ "/map.jinja" import syslog_ng with context %} | |||||
include: | |||||
- {{ sls_config_file }} | |||||
syslog_ng/service/running: | |||||
service.running: | |||||
- name: {{ syslog_ng.service }} | |||||
- enable: true | |||||
- require: | |||||
- sls: {{ sls_config_file }} |