From 90ea6c8d12fd110a8bef9ab372cfe3dd5ce5d59b Mon Sep 17 00:00:00 2001 From: e-taylor <41218855+e-taylor@users.noreply.github.com> Date: Mon, 5 Nov 2018 07:27:38 -0700 Subject: [PATCH] add support for the --be-name option (#43030) * add support for the --be-name option --- lib/ansible/modules/packaging/os/pkg5.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/pkg5.py b/lib/ansible/modules/packaging/os/pkg5.py index ac807d5c7d6..4690f7e8602 100644 --- a/lib/ansible/modules/packaging/os/pkg5.py +++ b/lib/ansible/modules/packaging/os/pkg5.py @@ -39,6 +39,11 @@ options: type: bool default: 'no' aliases: [ accept, accept_licences ] + be_name: + description: + - creates a new boot environment with the given name + version_added: "2.8" + type: str ''' EXAMPLES = ''' - name: Install Vim @@ -68,6 +73,7 @@ def main(): name=dict(type='list', required=True), state=dict(type='str', default='present', choices=['absent', 'installed', 'latest', 'present', 'removed', 'uninstalled']), accept_licenses=dict(type='bool', default=False, aliases=['accept', 'accept_licences']), + be_name=dict(type='str'), ), supports_check_mode=True, ) @@ -124,9 +130,14 @@ def ensure(module, state, packages, params): else: accept_licenses = [] + if params['be_name']: + beadm = ['--be-name=' + module.params['be_name']] + else: + beadm = [] + to_modify = filter(behaviour[state]['filter'], packages) if to_modify: - rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + ['-q', '--'] + to_modify) + rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + ['-q', '--'] + to_modify) response['rc'] = rc response['results'].append(out) response['msg'] += err