@@ -49,7 +49,7 @@ Available states | |||
^^^^^^^^^^^^^ | |||
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. | |||
@@ -57,6 +57,10 @@ Installs the syslog_ng package and optional packages which may provide additiona | |||
^^^^^^^^^^^^^^^^^^^^ | |||
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 | |||
------- | |||
@@ -72,32 +76,32 @@ Requirements | |||
$ gem install bundler | |||
$ bundle install | |||
$ bundle exec kitchen test [platform] | |||
$ bin/kitchen test [platform] | |||
Where ``[platform]`` is the platform name defined in ``kitchen.yml``, | |||
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. | |||
``kitchen destroy`` | |||
^^^^^^^^^^^^^^^^^^^ | |||
``bin/kitchen destroy`` | |||
^^^^^^^^^^^^^^^^^^^^^^^ | |||
Removes the docker instance. | |||
``kitchen test`` | |||
^^^^^^^^^^^^^^^^ | |||
``bin/kitchen test`` | |||
^^^^^^^^^^^^^^^^^^^^ | |||
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. |
@@ -154,7 +154,7 @@ suites: | |||
state_top: | |||
base: | |||
'*': | |||
- syslog_ng.config | |||
- syslog_ng | |||
pillars: | |||
top.sls: | |||
base: |
@@ -1,15 +0,0 @@ | |||
{% 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 |
@@ -0,0 +1,23 @@ | |||
# -*- 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 }} |
@@ -0,0 +1,5 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=sls | |||
include: | |||
- .file |
@@ -1,5 +1,9 @@ | |||
{%- 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') }} | |||
@@ -1,11 +1,7 @@ | |||
{% 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 |
@@ -0,0 +1,5 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=sls | |||
include: | |||
- .install |
@@ -0,0 +1,19 @@ | |||
# -*- 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 %} |
@@ -1,15 +0,0 @@ | |||
{% 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 %} |
@@ -0,0 +1,5 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=sls | |||
include: | |||
- .running |
@@ -0,0 +1,17 @@ | |||
# -*- 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 }} |