diff --git a/plugins/modules/load_caddy_config.py b/plugins/modules/load_caddy_config.py new file mode 100644 index 0000000..5595106 --- /dev/null +++ b/plugins/modules/load_caddy_config.py @@ -0,0 +1,104 @@ +# -*- 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_caddy_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 + default_tls_cert_dir: + escription: + - Default tls cert dir + 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' +''' \ No newline at end of file diff --git a/plugins/modules/load_caddy_relay_config.py b/plugins/modules/load_caddy_relay_config.py new file mode 100644 index 0000000..a6315a7 --- /dev/null +++ b/plugins/modules/load_caddy_relay_config.py @@ -0,0 +1,92 @@ +# -*- 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_caddy_relay_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 + target: + description: + - Default dns provider + 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' +''' \ No newline at end of file