Skip to content

Commit

Permalink
Add proxy options to templates_import module
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlazik1 committed Nov 12, 2024
1 parent a9a2e13 commit 26aa2af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions plugins/modules/templates_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@
- The directory within Git repo containing the templates.
required: false
type: str
http_proxy_policy:
description:
- HTTP proxy policy for template sync.
- You can choose no HTTP proxy, global HTTP proxy, or a custom HTTP proxy ('selected')
- If you choose 'selected', provide the http_proxy_id parameter.
required: false
type: str
choices:
- none
- global
- selected
http_proxy:
description:
- HTTP proxy to use for template sync.
- Use this parameter together with C(http_proxy_policy=selected)
required: false
type: str
attributes:
check_mode:
support: none
Expand Down Expand Up @@ -156,9 +173,12 @@ def main():
force=dict(type='bool'),
lock=dict(type='bool'),
negate=dict(type='bool'),
http_proxy_policy=dict(choices=['global', 'none', 'selected']),
http_proxy=dict(type='entity'),
),
supports_check_mode=False,
required_plugins=[('templates', ['*'])],
required_if=[('http_proxy_policy', 'selected', ['http_proxy'])],
)

with module.api_connection():
Expand Down
2 changes: 2 additions & 0 deletions tests/test_playbooks/tasks/templates_import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
force: "{{ templates_import_force | default(omit) }}"
lock: "{{ templates_import_lock | default(omit) }}"
negate: "{{ templates_import_negate | default(omit) }}"
http_proxy_policy: "{{ templates_import_http_proxy_policy | default(omit) }}"
http_proxy: "{{ templates_import_http_proxy | default(omit) }}"
locations: "{{ templates_import_locations | default(omit) }}"
organizations: "{{ templates_import_organizations | default(omit) }}"
register: result
Expand Down

0 comments on commit 26aa2af

Please sign in to comment.