haproxy/plugins/modules/load_haproxy_config.py
2023-06-13 17:21:45 +02:00

98 lines
3.0 KiB
Python

# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
author: Sebastien Clement (@sebclem)
module: load_haproxy_config
short_description: Load variables from files for haproxy config
description: []
version_added: "2.7"
options:
dir:
description:
- The directory name from which the variables should be loaded.
- If the path is relative and the task is inside a role, it will look inside the role's vars/ subdirectory.
- If the path is relative and not inside a role, it will be parsed relative to the playbook.
type: path
version_added: "2.1"
required: true
depth:
description:
- This module will, by default, recursively go through each sub directory and load up the
variables. By explicitly setting the depth, this module will only go as deep as the depth.
type: int
default: 0
version_added: "2.2"
default_domain:
description:
- Default root domain
type: str
version_added: "2.2"
required: true
default_dns_provider:
description:
- Default dns provider
type: str
version_added: "2.2"
required: true
default_dns_target:
description:
- Default dns target
type: str
version_added: "2.2"
required: true
attributes:
action:
details: While the action plugin does do some of the work it relies on the core engine to actually create the variables, that part cannot be overridden
support: partial
bypass_host_loop:
support: none
bypass_task_loop:
support: none
check_mode:
support: full
delegation:
details:
- while variable assignment can be delegated to a different host the execution context is always the current inventory_hostname
- connection variables, if set at all, would reflect the host it would target, even if we are not connecting at all in this case
support: partial
diff_mode:
support: none
core:
details: While parts of this action are implemented in core, other parts are still available as normal plugins and can be partially overridden
support: partial
seealso:
- module: ansible.builtin.set_fact
- ref: playbooks_delegation
description: More information related to task delegation.
'''
EXAMPLES = r'''
- name: Test
sebclem.haproxy.load_haproxy_config:
dir: vars/
default_domain: default_domain
default_dns_provider: default_dns_provider
default_dns_target: default_dns_target
'''
RETURN = r'''
ansible_facts:
description: Variables that were included and their values
returned: success
type: dict
sample: {'variable': 'value'}
ansible_included_var_files:
description: A list of files that were successfully included
returned: success
type: list
sample: [ /path/to/file.json, /path/to/file.yaml ]
version_added: '2.4'
'''