mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix documentation YAML for pkgin module
This commit is contained in:
parent
970ae584c9
commit
e9d5cf3bc2
2 changed files with 15 additions and 13 deletions
4
Makefile
4
Makefile
|
@ -180,3 +180,7 @@ modulejs:
|
|||
webdocs:
|
||||
(cd docsite; make docs)
|
||||
|
||||
# just for quick testing of all the module docs
|
||||
webdocs2:
|
||||
(cd docsite; make modules)
|
||||
|
||||
|
|
|
@ -26,29 +26,27 @@ module: pkgin
|
|||
short_description: Package manager for SmartOS
|
||||
description:
|
||||
- Manages SmartOS packages
|
||||
|
||||
version_added: "1.0"
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- name of package to install/remove
|
||||
required: true
|
||||
|
||||
state:
|
||||
description:
|
||||
- state of the package installed or absent.
|
||||
- state of the package
|
||||
choices: [ 'present', 'absent' ]
|
||||
required: false
|
||||
|
||||
default: present
|
||||
author: Shaun Zinck
|
||||
notes: []
|
||||
examples:
|
||||
- code: "pkgin: name=foo state=installed"
|
||||
- code: "pkgin: name=foo state=present"
|
||||
description: install package foo"
|
||||
- code: "pkgin: name=foo state=absent"
|
||||
description: remove package foo
|
||||
- code: "pkgin: name=foo,bar state=absent
|
||||
- code: "pkgin: name=foo,bar state=absent"
|
||||
description: remove packages foo and bar
|
||||
|
||||
'''
|
||||
|
||||
|
||||
|
@ -59,9 +57,9 @@ import sys
|
|||
|
||||
PKGIN_PATH = "/opt/local/bin/pkgin"
|
||||
|
||||
def query_package(module, name, state="installed"):
|
||||
def query_package(module, name, state="present"):
|
||||
|
||||
if state == "installed":
|
||||
if state == "present":
|
||||
|
||||
rc, out, err = module.run_command("%s list | grep ^%s" % (PKGIN_PATH, name))
|
||||
|
||||
|
@ -110,16 +108,16 @@ def install_packages(module, packages):
|
|||
install_c += 1
|
||||
|
||||
if install_c > 0:
|
||||
module.exit_json(changed=True, msg="installed %s package(s)" % (install_c))
|
||||
module.exit_json(changed=True, msg="present %s package(s)" % (install_c))
|
||||
|
||||
module.exit_json(changed=False, msg="package(s) already installed")
|
||||
module.exit_json(changed=False, msg="package(s) already present")
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
state = dict(default="installed", choices=["installed","absent"]),
|
||||
state = dict(default="present", choices=["present","absent"]),
|
||||
name = dict(aliases=["pkg"], required=True)))
|
||||
|
||||
|
||||
|
@ -130,7 +128,7 @@ def main():
|
|||
|
||||
pkgs = p["name"].split(",")
|
||||
|
||||
if p["state"] == "installed":
|
||||
if p["state"] == "present":
|
||||
install_packages(module, pkgs)
|
||||
|
||||
elif p["state"] == "absent":
|
||||
|
|
Loading…
Reference in a new issue