Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
e9d5cf3b
Commit
e9d5cf3b
authored
Jan 26, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix documentation YAML for pkgin module
parent
970ae584
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
Makefile
+4
-0
library/pkgin
+11
-13
No files found.
Makefile
View file @
e9d5cf3b
...
...
@@ -180,3 +180,7 @@ modulejs:
webdocs
:
(
cd
docsite
;
make docs
)
# just for quick testing of all the module docs
webdocs2
:
(
cd
docsite
;
make modules
)
library/pkgin
View file @
e9d5cf3b
...
...
@@ -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"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment