mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Provide a boolean switch to enable/disable publisher refresh
This commit is contained in:
parent
2cb9ec9f0e
commit
0622f387c4
1 changed files with 18 additions and 1 deletions
|
@ -44,12 +44,23 @@ options:
|
||||||
- creates a new boot environment with the given name
|
- creates a new boot environment with the given name
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
type: str
|
type: str
|
||||||
|
refresh:
|
||||||
|
description:
|
||||||
|
- refresh publishers before execution
|
||||||
|
version_added: "2.8"
|
||||||
|
type: bool
|
||||||
|
default: 'yes'
|
||||||
'''
|
'''
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Install Vim
|
- name: Install Vim
|
||||||
pkg5:
|
pkg5:
|
||||||
name: editor/vim
|
name: editor/vim
|
||||||
|
|
||||||
|
- name: Install Vim without refreshing publishers
|
||||||
|
pkg5:
|
||||||
|
name: editor/vim
|
||||||
|
refresh: no
|
||||||
|
|
||||||
- name: Remove finger daemon
|
- name: Remove finger daemon
|
||||||
pkg5:
|
pkg5:
|
||||||
name: service/network/finger
|
name: service/network/finger
|
||||||
|
@ -74,6 +85,7 @@ def main():
|
||||||
state=dict(type='str', default='present', choices=['absent', 'installed', 'latest', 'present', 'removed', 'uninstalled']),
|
state=dict(type='str', default='present', choices=['absent', 'installed', 'latest', 'present', 'removed', 'uninstalled']),
|
||||||
accept_licenses=dict(type='bool', default=False, aliases=['accept', 'accept_licences']),
|
accept_licenses=dict(type='bool', default=False, aliases=['accept', 'accept_licences']),
|
||||||
be_name=dict(type='str'),
|
be_name=dict(type='str'),
|
||||||
|
refresh=dict(type='bool', default=True),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
@ -135,9 +147,14 @@ def ensure(module, state, packages, params):
|
||||||
else:
|
else:
|
||||||
beadm = []
|
beadm = []
|
||||||
|
|
||||||
|
if params['refresh']:
|
||||||
|
no_refresh = []
|
||||||
|
else:
|
||||||
|
no_refresh = ['--no-refresh']
|
||||||
|
|
||||||
to_modify = filter(behaviour[state]['filter'], packages)
|
to_modify = filter(behaviour[state]['filter'], packages)
|
||||||
if to_modify:
|
if to_modify:
|
||||||
rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + ['-q', '--'] + to_modify)
|
rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + no_refresh + ['-q', '--'] + to_modify)
|
||||||
response['rc'] = rc
|
response['rc'] = rc
|
||||||
response['results'].append(out)
|
response['results'].append(out)
|
||||||
response['msg'] += err
|
response['msg'] += err
|
||||||
|
|
Loading…
Reference in a new issue