diff --git a/docs/icinga_user.rst b/docs/icinga_user.rst index ccc44b6c..7c5a1d07 100644 --- a/docs/icinga_user.rst +++ b/docs/icinga_user.rst @@ -63,6 +63,8 @@ Parameters Groups can be useful for various reasons. You might prefer to send notifications to groups instead of single users. + vars (optional, dict, {}) + Custom properties of the user. append (optional, bool, None) Do not overwrite the whole object but instead append the defined properties. @@ -149,7 +151,7 @@ Examples .. code-block:: yaml+jinja - + - name: Create user telekom_mms.icinga_director.icinga_user: state: present @@ -164,6 +166,9 @@ Examples - foousertemplate groups: - onCall + vars: + department: IT + role: CTO - name: Update user telekom_mms.icinga_director.icinga_user: diff --git a/docs/icinga_user_template.rst b/docs/icinga_user_template.rst index d3593e89..f9a9779d 100644 --- a/docs/icinga_user_template.rst +++ b/docs/icinga_user_template.rst @@ -47,6 +47,8 @@ Parameters zone (optional, str, None) Set the zone. + vars (optional, dict, {}) + Custom properties of the user template. append (optional, bool, None) Do not overwrite the whole object but instead append the defined properties. @@ -133,7 +135,7 @@ Examples .. code-block:: yaml+jinja - + - name: Create user template telekom_mms.icinga_director.icinga_user_template: state: present @@ -143,6 +145,8 @@ Examples object_name: "foousertemplate" enable_notifications: false period: '24/7' + vars: + department: IT zone: "foozone" - name: Update user template diff --git a/examples/icinga_user_template.yml b/examples/icinga_user_template.yml index a86bbf6c..a877ec5a 100644 --- a/examples/icinga_user_template.yml +++ b/examples/icinga_user_template.yml @@ -8,6 +8,8 @@ object_name: "foousertemplate" enable_notifications: false period: '24/7' + vars: + department: IT zone: "foozone" - name: Update user template telekom_mms.icinga_director.icinga_user_template: diff --git a/plugins/modules/icinga_user.py b/plugins/modules/icinga_user.py index f376aae8..3d479881 100644 --- a/plugins/modules/icinga_user.py +++ b/plugins/modules/icinga_user.py @@ -82,6 +82,11 @@ - Groups can be useful for various reasons. You might prefer to send notifications to groups instead of single users. type: list elements: str + vars: + description: + - Custom properties of the user. + type: "dict" + default: {} append: description: - Do not overwrite the whole object but instead append the defined properties. @@ -107,6 +112,9 @@ - foousertemplate groups: - onCall + vars: + department: IT + role: CTO - name: Update user telekom_mms.icinga_director.icinga_user: @@ -147,6 +155,7 @@ def main(): pager=dict(required=False), period=dict(required=False), groups=dict(type="list", elements="str", required=False), + vars=dict(type="dict", default={}, required=False), ) # Define the main module @@ -163,6 +172,7 @@ def main(): "pager", "period", "groups", + "vars", ] data = {} diff --git a/plugins/modules/icinga_user_template.py b/plugins/modules/icinga_user_template.py index e7492110..2daf3ce7 100644 --- a/plugins/modules/icinga_user_template.py +++ b/plugins/modules/icinga_user_template.py @@ -66,6 +66,11 @@ description: - Set the zone. type: str + vars: + description: + - Custom properties of the user. + type: "dict" + default: {} append: description: - Do not overwrite the whole object but instead append the defined properties. @@ -86,6 +91,8 @@ object_name: "foousertemplate" enable_notifications: false period: '24/7' + vars: + department: IT zone: "foozone" - name: Update user template @@ -123,6 +130,7 @@ def main(): imports=dict(type="list", elements="str", default=[], required=False), period=dict(required=False), enable_notifications=dict(type="bool", required=False), + vars=dict(type="dict", default={}, required=False), zone=dict(required=False, default=None), ) @@ -136,6 +144,7 @@ def main(): "imports", "period", "enable_notifications", + "vars", "zone", ] diff --git a/roles/ansible_icinga/README.md b/roles/ansible_icinga/README.md index 767e6962..412a66db 100644 --- a/roles/ansible_icinga/README.md +++ b/roles/ansible_icinga/README.md @@ -24,45 +24,45 @@ Tags: icinga - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `command`: - description: - + - "The command Icinga should run." - + - "Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed." - + - "Spaces will lead to separation of command path and standalone arguments." - + - "Please note that this means that we do not support spaces in plugin names and paths right now." - + - default: "" - type: "str" - required: "no" - + - `command_type`: - description: - + - "Plugin Check commands are what you need when running checks against your infrastructure." - + - "Notification commands will be used when it comes to notify your users." - + - "Event commands allow you to trigger specific actions when problems occur." - + - "Some people use them for auto-healing mechanisms, like restarting services or rebooting systems at specific thresholds." - + - Choices: - PluginCheck - PluginNotification @@ -70,120 +70,120 @@ Tags: icinga - default: "PluginCheck" - type: "str" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `name`: - description: - + - "Name of the command template." - + - default: "" - type: "str" - required: "yes" - + - `imports`: - description: - + - "Importable templates, add as many as you want. Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `timeout`: - description: - + - "Optional command timeout. Allowed values are seconds or durations postfixed with a specific unit (for example 1m or also 3m 30s)." - + - default: "" - type: "str" - required: "no" - + - `zone`: - description: - + - "Icinga cluster zone. Allows to manually override Directors decisions of where to deploy your config to." - + - "You should consider not doing so unless you gained deep understanding of how an Icinga Cluster stack works." - + - default: "" - type: "str" - required: "no" - + - `vars`: - description: - + - "Custom properties of the command template." - + - default: "" - type: "dict" - required: "no" - + - `arguments`: - description: - + - "Arguments of the command template." - + - default: "" - type: "dict" - required: "no" - + - `icinga_commands`: - Default: `` - Description: A list of Icinga commands to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `command`: - description: - + - "The command Icinga should run. Required when state is C(present)." - + - "Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed." - + - "Spaces will lead to separation of command path and standalone arguments." - + - "Please note that this means that we do not support spaces in plugin names and paths right now." - + - default: "" - type: "str" - required: "no" - + - `command_type`: - description: - + - "Plugin Check commands are what you need when running checks against your infrastructure." - + - "Notification commands will be used when it comes to notify your users." - + - "Event commands allow you to trigger specific actions when problems occur." - + - "Some people use them for auto-healing mechanisms, like restarting services or rebooting systems at specific thresholds." - + - Choices: - PluginCheck - PluginNotification @@ -191,1848 +191,1866 @@ Tags: icinga - default: "PluginCheck" - type: "str" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `name`: - description: - + - "Name of the command." - + - default: "" - type: "str" - required: "yes" - + - `imports`: - description: - + - "Importable templates, add as many as you want. Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `timeout`: - description: - + - "Optional command timeout. Allowed values are seconds or durations postfixed with a specific unit (for example 1m or also 3m 30s)." - + - default: "" - type: "str" - required: "no" - + - `zone`: - description: - + - "Icinga cluster zone. Allows to manually override Directors decisions of where to deploy your config to." - + - "You should consider not doing so unless you gained deep understanding of how an Icinga Cluster stack works." - + - default: "" - type: "str" - required: "no" - + - `vars`: - description: - + - "Custom properties of the command." - + - default: "" - type: "dict" - required: "no" - + - `arguments`: - description: - + - "Arguments of the command." - + - default: "" - type: "dict" - required: "no" - + - `icinga_endpoints`: - Default: `` - Description: A list of Icinga endpoints to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Icinga object name for this endpoint." - + - "This is usually a fully qualified host name but it could basically be any kind of string." - + - "To make things easier for your users we strongly suggest to use meaningful names for templates." - + - "For example "generic-endpoint" is ugly, "Standard Linux Server" is easier to understand." - + - default: "" - type: "str" - required: "yes" - + - `host`: - description: - + - "The hostname/IP address of the remote Icinga 2 instance." - + - default: "" - type: "str" - required: "no" - + - `port`: - description: - + - "The service name/port of the remote Icinga 2 instance. Defaults to 5665." - + - default: "" - type: "int" - required: "no" - + - `log_duration`: - description: - + - "Duration for keeping replay logs on connection loss. Defaults to 1d (86400 seconds). Attribute is specified in seconds. If log_duration is set to 0, replaying logs is disabled. You could also specify the value in human readable format like 10m for 10 minutes or 1h for one hour." - + - default: "" - type: "str" - required: "no" - + - `zone`: - description: - + - "The name of the zone this endpoint is part of." - + - default: "" - type: "str" - required: "no" - + - `icinga_host_templates`: - Default: `` - Description: A list of Icinga host_templates to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Icinga object name for this host template." - + - "This is usually a fully qualified host name but it could basically be any kind of string." - + - "To make things easier for your users we strongly suggest to use meaningful names for templates." - + - "For example "generic-host" is ugly, "Standard Linux Server" is easier to understand." - + - default: "" - type: "str" - required: "yes" - + - `display_name`: - description: - + - "Alternative name for this host." - + - "Might be a host alias or and kind of string helping your users to identify this host." - + - default: "" - type: "str" - required: "no" - + - `address`: - description: - + - "Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with." - + - default: "" - type: "str" - required: "no" - + - `address6`: - description: - + - "Host IPv6 address. Usually an IPv64 address, but may be any kind of address your check plugin is able to deal with." - + - default: "" - type: "str" - required: "no" - + - `groups`: - description: - + - "Hostgroups that should be directly assigned to this node. Hostgroups can be useful for various reasons." - + - "You might assign service checks based on assigned hostgroup. They are also often used as an instrument to enforce restricted views in Icinga Web 2." - + - "Hostgroups can be directly assigned to single hosts or to host templates." - + - "You might also want to consider assigning hostgroups using apply rules." - + - default: "[]" - type: "list" - required: "no" - + - `check_command`: - description: - + - "The name of the check command." - + - "Though this is not required to be defined in the director, you still have to supply a check_command in a host or host-template." - + - default: "" - type: "str" - required: "no" - + - `event_command`: - description: - + - "Event command for host which gets called on every check execution if one of these conditions matches" - + - "The host is in a soft state" - + - "The host state changes into a hard state" - + - "The host state recovers from a soft or hard state to OK/Up" - + - default: "" - type: "str" - required: "no" - + - `check_interval`: - description: - + - "Your regular check interval." - + - default: "" - type: "str" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `imports`: - description: - + - "Choose a host-template." - + - default: "" - type: "list" - required: "no" - + - `zone`: - description: - + - "Set the zone." - + - default: "" - type: "str" - required: "no" - + - `vars`: - description: - + - "Custom properties of the host." - + - default: "" - type: "dict" - required: "no" - + - `notes`: - description: - + - "Additional notes for this object." - + - default: "" - type: "str" - required: "no" - + - `notes_url`: - description: - + - "An URL pointing to additional notes for this object." - + - "Separate multiple urls like this "http://url1 http://url2"" - + - "Maximum length is 255 characters." - + - default: "" - type: "str" - required: "no" - + - `has_agent`: - description: - + - "Whether this host has the Icinga 2 Agent installed." - + - Choices: - True - False - default: "" - type: "bool" - required: "no" - + - `master_should_connect`: - description: - + - "Whether the parent (master) node should actively try to connect to this agent." - + - Choices: - True - False - default: "" - type: "bool" - required: "no" - + - `accept_config`: - description: - + - "Whether the agent is configured to accept config." - + - Choices: - True - False - default: "" - type: "bool" - required: "no" - + - `icinga_hostgroups`: - Default: `` - Description: A list of Icinga hostgroups to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Icinga object name for this hostgroup." - + - default: "" - type: "str" - required: "yes" - + - `display_name`: - description: - + - "An alternative display name for this group." - + - "If you wonder how this could be helpful just leave it blank." - + - default: "" - type: "str" - required: "no" - + - `assign_filter`: - description: - + - "This allows you to configure an assignment filter." - + - "Please feel free to combine as many nested operators as you want." - + - default: "" - type: "str" - required: "no" - + - `icinga_hosts`: - Default: `` - Description: A list of Icinga hosts to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Icinga object name for this host." - + - "This is usually a fully qualified host name but it could basically be any kind of string." - + - "To make things easier for your users we strongly suggest to use meaningful names for templates." - + - "For example "generic-host" is ugly, "Standard Linux Server" is easier to understand." - + - default: "" - type: "str" - required: "yes" - + - `display_name`: - description: - + - "Alternative name for this host. Might be a host alias or and kind of string helping your users to identify this host." - + - default: "" - type: "str" - required: "no" - + - `address`: - description: - + - "Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with." - + - default: "" - type: "str" - required: "no" - + - `address6`: - description: - + - "Host IPv6 address. Usually an IPv6 address, but may be any kind of address your check plugin is able to deal with." - + - default: "" - type: "str" - required: "no" - + - `groups`: - description: - + - "Hostgroups that should be directly assigned to this node. Hostgroups can be useful for various reasons." - + - "You might assign service checks based on assigned hostgroup. They are also often used as an instrument to enforce restricted views in Icinga Web 2." - + - "Hostgroups can be directly assigned to single hosts or to host templates." - + - "You might also want to consider assigning hostgroups using apply rules." - + - default: "[]" - type: "list" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `imports`: - description: - + - "Choose a Host Template. Required when state is C(present)." - + - default: "" - type: "list" - required: "no" - + - `zone`: - description: - + - "Set the zone." - + - default: "" - type: "str" - required: "no" - + - `vars`: - description: - + - "Custom properties of the host." - + - default: "" - type: "dict" - required: "no" - + - `check_command`: - description: - + - "The name of the check command." - + - "Though this is not required to be defined in the director, you still have to supply a check_command in a host or host-template." - + - default: "" - type: "str" - required: "no" - + - `notes`: - description: - + - "Additional notes for this object." - + - default: "" - type: "str" - required: "no" - + - `notes_url`: - description: - + - "An URL pointing to additional notes for this object." - + - "Separate multiple urls like this "http://url1 http://url2"" - + - "The maximum length is 255 characters." - + - default: "" - type: "str" - required: "no" - + - `has_agent`: - description: - + - "Whether this host has the Icinga 2 Agent installed." - + - Choices: - True - False - default: "" - type: "bool" - required: "no" - + - `master_should_connect`: - description: - + - "Whether the parent (master) node should actively try to connect to this agent." - + - Choices: - True - False - default: "" - type: "bool" - required: "no" - + - `accept_config`: - description: - + - "Whether the agent is configured to accept config." - + - Choices: - True - False - default: "" - type: "bool" - required: "no" - + - `icinga_notifications`: - Default: `` - Description: A list of Icinga notifications to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name of the notification." - + - default: "" - type: "str" - required: "yes" - + - `notification_interval`: - description: - + - "The notification interval (in seconds). This interval is used for active notifications." - + - "Defaults to 30 minutes. If set to 0, re-notifications are disabled." - + - default: "" - type: "str" - required: "no" - + - `types`: - description: - + - "The state transition types you want to get notifications for." - + - default: "" - type: "list" - required: "no" - + - `users`: - description: - + - "Users that should be notified by this notification." - + - default: "" - type: "list" - required: "no" - + - `states`: - description: - + - "The host or service states you want to get notifications for." - + - default: "" - type: "list" - required: "no" - + - `apply_to`: - description: - + - "Whether this notification should affect hosts or services." - + - Choices: - host - service - default: "" - type: "str" - required: "yes" - + - `assign_filter`: - description: - + - "The filter where the notification will take effect." - + - default: "" - type: "str" - required: "no" - + - `imports`: - description: - + - "Importable templates, add as many as you want. Required when state is C(present)." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `vars`: - description: - + - "Custom properties of the notification." - + - default: "" - type: "dict" - required: "no" - + - `time_period`: - description: - + - "The name of a time period which determines when this notification should be triggered." - + - default: "" - type: "strod" - required: "no" - + - `times_begin`: - description: - + - "First notification delay." - + - "Delay unless the first notification should be sent." - + - default: "" - type: "int" - required: "no" - + - `times_end`: - description: - + - "Last notification." - + - "When the last notification should be sent." - + - default: "" - type: "int" - required: "no" - + - `user_groups`: - description: - + - "User Groups that should be notified by this notification." - + - default: "" - type: "list" - required: "no" - + - `icinga_service_applies`: - Default: `` - Description: A list of Icinga service_applies to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name for the Icinga service apply rule." - + - default: "" - type: "str" - required: "yes" - + - `display_name`: - description: - + - "Alternative displayed name of the service apply rule." - + - default: "" - type: "str" - required: "no" - + - `check_command`: - description: - + - "Check command definition." - + - default: "" - type: "str" - required: "no" - + - `check_interval`: - description: - + - "Your regular check interval." - + - default: "" - type: "str" - required: "no" - + - `check_period`: - description: - + - "The name of a time period which determines when this object should be monitored. Not limited by default." - + - default: "" - type: "str" - required: "no" - + - `check_timeout`: - description: - + - "Check command timeout in seconds. Overrides the CheckCommand's timeout attribute." - + - default: "" - type: "str" - required: "no" - + - `enable_active_checks`: - description: - + - "Whether to actively check this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_event_handler`: - description: - + - "Whether to enable event handlers this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_notifications`: - description: - + - "Whether to send notifications for this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_passive_checks`: - description: - + - "Whether to accept passive check results for this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_perfdata`: - description: - + - "Whether to process performance data provided by this object." - + - default: "" - type: "bool" - required: "no" - + - `max_check_attempts`: - description: - + - "Defines after how many check attempts a new hard state is reached." - + - default: "" - type: "str" - required: "no" - + - `retry_interval`: - description: - + - "Retry interval, will be applied after a state change unless the next hard state is reached." - + - default: "" - type: "str" - required: "no" - + - `groups`: - description: - + - "Service groups that should be directly assigned to this service." - + - "Servicegroups can be useful for various reasons." - + - "They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions." - + - "Service groups can be directly assigned to single services or to service templates." - + - default: "" - type: "list" - required: "no" - + - `apply_for`: - description: - + - "Evaluates the apply for rule for all objects with the custom attribute specified." - + - "For example selecting "host.vars.custom_attr" will generate "for (config in host.vars.array_var)" where "config" will be accessible through "$config$"." - + - "Note - only custom variables of type "Array" are eligible." - + - default: "" - type: "str" - required: "no" - + - `assign_filter`: - description: - + - "The filter where the service apply rule will take effect." - + - default: "" - type: "str" - required: "no" - + - `command_endpoint`: - description: - + - "The host where the service should be executed on." - + - default: "" - type: "str" - required: "no" - + - `imports`: - description: - + - "Importable templates, add as many as you want." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `vars`: - description: - + - "Custom properties of the service apply rule." - + - default: "" - type: "dict" - required: "no" - + - `notes`: - description: - + - "Additional notes for this object." - + - default: "" - type: "str" - required: "no" - + - `notes_url`: - description: - + - "An URL pointing to additional notes for this object." - + - "Separate multiple urls like this "http://url1 http://url2"" - + - "Maximum length is 255 characters." - + - default: "" - type: "str" - required: "no" - + - `icinga_service_templates`: - Default: `` - Description: A list of Icinga service_templat to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name of the service template." - + - default: "" - type: "str" - required: "yes" - + - `check_command`: - description: - + - "Check command definition." - + - default: "" - type: "str" - required: "no" - + - `check_interval`: - description: - + - "Your regular check interval." - + - default: "" - type: "str" - required: "no" - + - `check_period`: - description: - + - "The name of a time period which determines when this object should be monitored. Not limited by default." - + - default: "" - type: "str" - required: "no" - + - `check_timeout`: - description: - + - "Check command timeout in seconds. Overrides the CheckCommand's timeout attribute." - + - default: "" - type: "str" - required: "no" - + - `enable_active_checks`: - description: - + - "Whether to actively check this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_event_handler`: - description: - + - "Whether to enable event handlers this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_notifications`: - description: - + - "Whether to send notifications for this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_passive_checks`: - description: - + - "Whether to accept passive check results for this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_perfdata`: - description: - + - "Whether to process performance data provided by this object." - + - default: "" - type: "bool" - required: "no" - + - `event_command`: - description: - + - "Event command for service which gets called on every check execution if one of these conditions matches" - + - "The service is in a soft state" - + - "The service state changes into a hard state" - + - "The service state recovers from a soft or hard state to OK/Up" - + - default: "" - type: "str" - required: "no" - + - `groups`: - description: - + - "Service groups that should be directly assigned to this service." - + - "Servicegroups can be useful for various reasons." - + - "They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions." - + - "Service groups can be directly assigned to single services or to service templates." - + - default: "[]" - type: "list" - required: "no" - + - `imports`: - description: - + - "Importable templates, add as many as you want." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "[]" - type: "list" - required: "no" - + - `max_check_attempts`: - description: - + - "Defines after how many check attempts a new hard state is reached." - + - default: "" - type: "str" - required: "no" - + - `notes`: - description: - + - "Additional notes for this object." - + - default: "" - type: "str" - required: "no" - + - `notes_url`: - description: - + - "An URL pointing to additional notes for this object." - + - "Separate multiple urls like this "http://url1 http://url2"" - + - "Maximum length is 255 characters." - + - default: "" - type: "str" - required: "no" - + - `retry_interval`: - description: - + - "Retry interval, will be applied after a state change unless the next hard state is reached." - + - default: "" - type: "str" - required: "no" - + - `use_agent`: - description: - + - "Whether the check command for this service should be executed on the Icinga agent." - + - default: "" - type: "bool" - required: "no" - + - `vars`: - description: - + - "Custom properties of the service template." - + - default: "{}" - type: "dict" - required: "no" - + - `volatile`: - description: - + - "Whether this check is volatile." - + - default: "" - type: "bool" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `icinga_servicegroups`: - Default: `` - Description: A list of Icinga sservicegroups to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name for the Icinga servicegroup." - + - default: "" - type: "str" - required: "yes" - + - `display_name`: - description: - + - "An alternative display name for this group." - + - "If you wonder how this could be helpful just leave it blank." - + - default: "" - type: "str" - required: "no" - + - `assign_filter`: - description: - + - "This allows you to configure an assignment filter." - + - "Please feel free to combine as many nested operators as you want." - + - default: "" - type: "str" - required: "no" - + - `icinga_services`: - Default: `` - Description: A list of Icinga services to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name of the service." - + - default: "" - type: "str" - required: "yes" - + - `check_command`: - description: - + - "Check command definition." - + - default: "" - type: "str" - required: "no" - + - `check_interval`: - description: - + - "Your regular check interval." - + - default: "" - type: "str" - required: "no" - + - `check_period`: - description: - + - "The name of a time period which determines when this object should be monitored. Not limited by default." - + - default: "" - type: "str" - required: "no" - + - `check_timeout`: - description: - + - "Check command timeout in seconds. Overrides the CheckCommand's timeout attribute." - + - default: "" - type: "str" - required: "no" - + - `enable_active_checks`: - description: - + - "Whether to actively check this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_event_handler`: - description: - + - "Whether to enable event handlers this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_notifications`: - description: - + - "Whether to send notifications for this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_passive_checks`: - description: - + - "Whether to accept passive check results for this object." - + - default: "" - type: "bool" - required: "no" - + - `enable_perfdata`: - description: - + - "Whether to process performance data provided by this object." - + - default: "" - type: "bool" - required: "no" - + - `groups`: - description: - + - "Service groups that should be directly assigned to this service." - + - "Servicegroups can be useful for various reasons." - + - "They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions." - + - "Service groups can be directly assigned to single services or to service templates." - + - default: "[]" - type: "list" - required: "no" - + - `host`: - description: - + - "Choose the host this single service should be assigned to." - + - default: "" - type: "str" - required: "yes" - + - `imports`: - description: - + - "Importable templates, add as many as you want." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "[]" - type: "list" - required: "no" - + - `max_check_attempts`: - description: - + - "Defines after how many check attempts a new hard state is reached." - + - default: "" - type: "str" - required: "no" - + - `notes`: - description: - + - "Additional notes for this object." - + - default: "" - type: "str" - required: "no" - + - `notes_url`: - description: - + - "An URL pointing to additional notes for this object." - + - "Separate multiple urls like this "http://url1 http://url2"" - + - "Maximum length is 255 characters." - + - default: "" - type: "str" - required: "no" - + - `retry_interval`: - description: - + - "Retry interval, will be applied after a state change unless the next hard state is reached." - + - default: "" - type: "str" - required: "no" - + - `use_agent`: - description: - + - "Whether the check command for this service should be executed on the Icinga agent." - + - default: "" - type: "bool" - required: "no" - + - `vars`: - description: - + - "Custom properties of the service." - + - default: "{}" - type: "dict" - required: "no" - + - `volatile`: - description: - + - "Whether this check is volatile." - + - default: "" - type: "bool" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `icinga_timeperiods`: - Default: `` - Description: A list of Icinga timeperiods to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name of the time period." - + - default: "" - type: "str" - required: "no" - + - `display_name`: - description: - + - "Alternative name for this timeperiod." - + - default: "" - type: "str" - required: "no" - + - `imports`: - description: - + - "Importable templates, add as many as you want." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `ranges`: - description: - + - "A" - + - " " - + - "d" - + - "i" - + - "c" - + - "t" - + - " " - + - "o" - + - "f" - + - " " - + - "d" - + - "a" - + - "y" - + - "s" - + - " " - + - "a" - + - "n" - + - "d" - + - " " - + - "t" - + - "i" - + - "m" - + - "e" - + - "p" - + - "e" - + - "r" - + - "i" - + - "o" - + - "d" - + - "s" - + - "." - + - default: "" - type: "dict" - required: "no" - + - `icinga_user_templates`: - Default: `` - Description: A list of Icinga user_templates to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name of the user template." - + - default: "" - type: "str" - required: "yes" - + - `imports`: - description: - + - "Importable templates, add as many as you want." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `period`: - description: - + - "The name of a time period which determines when notifications to this User should be triggered. Not set by default." - + - default: "" - type: "str" - required: "no" - + - `enable_notifications`: - description: - + - "Whether to send notifications for this user." - + - default: "" - type: "bool" - required: "no" - + + - `vars`: + - description: + + - "Custom properties of the user template." + + - default: "" + - type: "dict" + - required: "no" + - `icinga_users`: - Default: `` - Description: A list of Icinga users to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Name of the user." - + - default: "" - type: "str" - required: "yes" - + - `display_name`: - description: - + - "Alternative name for this user." - + - "In case your object name is a username, this could be the full name of the corresponding person." - + - default: "" - type: "str" - required: "no" - + - `imports`: - description: - + - "Importable templates, add as many as you want." - + - "Please note that order matters when importing properties from multiple templates - last one wins." - + - default: "" - type: "list" - required: "no" - + - `pager`: - description: - + - "The pager address of the user." - + - default: "" - type: "str" - required: "no" - + - `period`: - description: - + - "The name of a time period which determines when notifications to this User should be triggered. Not set by default." - + - default: "" - type: "str" - required: "no" - + - `disabled`: - description: - + - "Disabled objects will not be deployed." - + - Choices: - True - False - default: "False" - type: "bool" - required: "no" - + - `email`: - description: - + - "The Email address of the user." - + - default: "" - type: "str" - required: "no" - + - `groups`: - description: - + - "User groups that should be directly assigned to this user." - + - "Groups can be useful for various reasons. You might prefer to send notifications to groups instead of single users." - + - default: "" - type: "list" - required: "no" - + + - `vars`: + - description: + + - "Custom properties of the user." + + - default: "" + - type: "dict" + - required: "no" + - `icinga_zones`: - Default: `` - Description: A list of Icinga zones to configure - Type: list of 'str' - Required: no - Options: - + - `state`: - description: - + - "Apply feature state." - + - Choices: - present - absent - default: "present" - type: "str" - required: "no" - + - `name`: - description: - + - "Icinga object name for this zone." - + - "This is usually a fully qualified host name but it could basically be any kind of string." - + - "To make things easier for your users we strongly suggest to use meaningful names for templates." - + - "For example "generic-zone" is ugly, "Standard Linux Server" is easier to understand." - + - default: "" - type: "str" - required: "yes" - + - `is_global`: - description: - + - "Whether configuration files for this zone should be synced to all endpoints." - + - default: "False" - type: "bool" - required: "no" - + - `parent`: - description: - + - "The name of the parent zone." - + - default: "" - type: "str" - required: "no" - + - `icinga_client_cert`: - Default: `` - Description: PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, `client_key' is not required. - Type: path - Required: no - + - `icinga_client_key`: - Default: `` - Description: PEM formatted file that contains your private key to be used for SSL client authentication. If `client_cert' contains both the certificate and key, this option is not required. - Type: path - Required: no - + - `icinga_url`: - Default: `` - Description: HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path - Type: str - Required: no - + - `icinga_url_password`: - Default: `` - Description: The password for use in HTTP basic authentication. If the `url_username' parameter is not specified, the `url_password' parameter will not be used. - Type: str - Required: no - + - `icinga_url_username`: - Default: `` - Description: The username for use in HTTP basic authentication. This parameter can be used without `url_password' for sites that allow empty passwords - Type: str - Required: no - + - `icinga_use_gssapi`: - Default: `false` - Description: Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. Requires the Python library gssapi to be installed. Credentials for GSSAPI can be specified with `url_username'/`url_password' or with the GSSAPI env var `KRB5CCNAME' that specified a custom Kerberos credential cache. NTLM authentication is `not' supported even if the GSSAPI mech for NTLM has been installed. - Type: bool - Required: no - + - `icinga_use_proxy`: - Default: `true` - Description: If `no', it will not use a proxy, even if one is defined in an environment variable on the target hosts. - Type: bool - Required: no - + - `icinga_validate_certs`: - Default: `true` - Description: If `no', SSL certificates will not be validated. icinga_This should only be used on personally controlled sites using selfigned certificates. - Type: bool - Required: no - + ## Dependencies diff --git a/roles/ansible_icinga/meta/argument_specs.yml b/roles/ansible_icinga/meta/argument_specs.yml index 399552ba..eee797f5 100644 --- a/roles/ansible_icinga/meta/argument_specs.yml +++ b/roles/ansible_icinga/meta/argument_specs.yml @@ -77,6 +77,11 @@ argument_specs: description: - Whether to send notifications for this user. type: bool + vars: + description: + - Custom properties of the user. + type: "dict" + default: {} icinga_users: description: - A list of Icinga users to configure @@ -141,6 +146,11 @@ argument_specs: send notifications to groups instead of single users. type: list elements: str + vars: + description: + - Custom properties of the user. + type: "dict" + default: {} icinga_endpoints: description: - A list of Icinga endpoints to configure diff --git a/roles/ansible_icinga/tasks/icinga_user.yml b/roles/ansible_icinga/tasks/icinga_user.yml index 83fde7ca..822ad065 100644 --- a/roles/ansible_icinga/tasks/icinga_user.yml +++ b/roles/ansible_icinga/tasks/icinga_user.yml @@ -17,6 +17,7 @@ period: "{{ user.period | default(omit) }}" disabled: "{{ user.disabled | default(omit) }}" email: "{{ user.email | default(icinga_user_email) }}" + vars: "{{ user.vars | default(omit) }}" retries: 3 delay: 3 register: result diff --git a/roles/ansible_icinga/tasks/icinga_user_template.yml b/roles/ansible_icinga/tasks/icinga_user_template.yml index 3afc3665..606ef7f8 100644 --- a/roles/ansible_icinga/tasks/icinga_user_template.yml +++ b/roles/ansible_icinga/tasks/icinga_user_template.yml @@ -14,6 +14,7 @@ imports: "{{ user_template.imports | default(omit) }}" period: "{{ user_template.period | default(omit) }}" enable_notifications: "{{ user_template.enable_notifications | default(omit) }}" + vars: "{{ user_template.vars | default(omit) }}" zone: "{{ user_template.zone | default(omit) }}" retries: 3 delay: 3 diff --git a/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user.yml b/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user.yml index 9336a612..549f93d5 100644 --- a/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user.yml +++ b/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user.yml @@ -11,6 +11,9 @@ email: "foouser@example.com" groups: - onCall + vars: + department: IT + role: CTO - name: Update user telekom_mms.icinga_director.icinga_user: state: absent diff --git a/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user_template.yml b/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user_template.yml index 957a96b7..c183ef77 100644 --- a/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user_template.yml +++ b/tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_user_template.yml @@ -8,6 +8,8 @@ object_name: "foousertemplate" enable_notifications: false period: '24/7' + vars: + department: IT zone: "foozone" - name: Update user template telekom_mms.icinga_director.icinga_user_template: diff --git a/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user.yml b/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user.yml index 869a0322..56da92b3 100644 --- a/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user.yml +++ b/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user.yml @@ -13,6 +13,9 @@ - foousertemplate groups: - onCall + vars: + department: IT + role: CTO - name: Update user telekom_mms.icinga_director.icinga_user: state: present diff --git a/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user_template.yml b/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user_template.yml index a86bbf6c..611e18e7 100644 --- a/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user_template.yml +++ b/tests/integration/targets/icinga/roles/icinga/tasks/icinga_user_template.yml @@ -9,6 +9,8 @@ enable_notifications: false period: '24/7' zone: "foozone" + vars: + department: IT - name: Update user template telekom_mms.icinga_director.icinga_user_template: state: present diff --git a/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user.yml b/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user.yml index e7ef2686..6c5b9f13 100644 --- a/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user.yml +++ b/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user.yml @@ -13,6 +13,9 @@ - foousertemplate groups: - onCall + vars: + department: IT + role: CTO ignore_errors: true register: result - assert: diff --git a/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user_template.yml b/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user_template.yml index 4c1e9300..9e15114f 100644 --- a/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user_template.yml +++ b/tests/integration/targets/icinga/roles/icinga/tasks/wrong_pass_icinga_user_template.yml @@ -8,6 +8,8 @@ object_name: "foousertemplate" enable_notifications: false period: '24/7' + vars: + department: IT zone: "foozone" ignore_errors: true register: result