Add variables to kpm module

This commit is contained in:
ant31 2016-05-04 17:46:29 +02:00 committed by Smana
parent cd2847c1b9
commit c43f9bc705
2 changed files with 8 additions and 0 deletions

View file

@ -37,6 +37,11 @@ options:
default: 'None' default: 'None'
description: description:
- The package version - The package version
variables:
required: false
default: 'None'
description:
- Set package variables
state: state:
required: false required: false
choices: ['present', 'absent'] choices: ['present', 'absent']
@ -78,11 +83,13 @@ def main():
state = dict(default='present', choices=['present', 'absent']), state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True), name = dict(required=True),
force = dict(required=False, default=False, type='bool'), force = dict(required=False, default=False, type='bool'),
variables = dict(required=False, default=None, type='dict'),
registry = dict(required=False, default="https://api.kpm.sh"), registry = dict(required=False, default="https://api.kpm.sh"),
namespace=dict(default='default', required=False))) namespace=dict(default='default', required=False)))
params = {"version": module.params.get("version"), params = {"version": module.params.get("version"),
"namespace": module.params.get('namespace'), "namespace": module.params.get('namespace'),
"variables": module.params.get('variables'),
"endpoint": module.params.get('registry'), "endpoint": module.params.get('registry'),
"dry": module.check_mode, "dry": module.check_mode,
"proxy": None, "proxy": None,

View file

@ -4,6 +4,7 @@
registry: "{{item.registry | default(kpm_registry | default('https://api.kpm.sh'))}}" registry: "{{item.registry | default(kpm_registry | default('https://api.kpm.sh'))}}"
state: "{{item.state | default(omit)}}" state: "{{item.state | default(omit)}}"
version: "{{item.version | default(omit)}}" version: "{{item.version | default(omit)}}"
variables: "{{item.variables | default(omit)}}"
name: "{{item.name}}" name: "{{item.name}}"
with_items: "{{kpm_packages}}" with_items: "{{kpm_packages}}"
register: kpmresults register: kpmresults