mirror of https://github.com/kewlfft/ansible-aur
support name type list
parent
0c083b7899
commit
091077c382
|
@ -13,7 +13,7 @@
|
||||||
## Options
|
## Options
|
||||||
|parameter|required |default |choices |comments|
|
|parameter|required |default |choices |comments|
|
||||||
|--- |--- |--- |--- |---|
|
|--- |--- |--- |--- |---|
|
||||||
|name |no | | |Name of the package to install or upgrade.|
|
|name |no | | |Name or list of names of the package(s) to install or upgrade.|
|
||||||
|upgrade |no |no |yes, no |Whether or not to upgrade whole system.|
|
|upgrade |no |no |yes, no |Whether or not to upgrade whole system.|
|
||||||
|helper |no |pacaur |pacaur, trizen, yaourt, yay |Helper to use.|
|
|helper |no |pacaur |pacaur, trizen, yaourt, yay |Helper to use.|
|
||||||
|
|
||||||
|
@ -39,7 +39,11 @@
|
||||||
become_user: user_that_has_nopasswd_in_sudoers_for_pacman_use
|
become_user: user_that_has_nopasswd_in_sudoers_for_pacman_use
|
||||||
|
|
||||||
# Install (using trizen)
|
# Install (using trizen)
|
||||||
- aur: name=package_name helper=trizen
|
- aur:
|
||||||
|
helper: trizen
|
||||||
|
name:
|
||||||
|
- package_name_1
|
||||||
|
- package_name_2
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
# Upgrade (using pacaur)
|
# Upgrade (using pacaur)
|
||||||
|
|
14
aur.py
14
aur.py
|
@ -24,18 +24,18 @@ def upgrade(module, helper):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def install_packages(module, package_name, helper):
|
def install_packages(module, packages, helper):
|
||||||
assert helper in helper_cmd
|
assert helper in helper_cmd
|
||||||
|
|
||||||
cmd = helper_cmd[helper] + [package_name]
|
changed_iter = False
|
||||||
|
for package in packages:
|
||||||
if upgrade:
|
cmd = helper_cmd[helper] + [package]
|
||||||
cmd += ['-u']
|
|
||||||
|
|
||||||
rc, out, err = module.run_command(cmd, check_rc=True)
|
rc, out, err = module.run_command(cmd, check_rc=True)
|
||||||
|
changed_iter = changed_iter or not (out == '' or '-- skipping' in out)
|
||||||
|
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
changed=not (out == '' or '-- skipping' in out),
|
changed=changed_iter,
|
||||||
msg='installed package',
|
msg='installed package',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec={
|
argument_spec={
|
||||||
'name': {
|
'name': {
|
||||||
'required': False,
|
'type': 'list',
|
||||||
},
|
},
|
||||||
'upgrade': {
|
'upgrade': {
|
||||||
'default': False,
|
'default': False,
|
||||||
|
|
Loading…
Reference in New Issue