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
17f3cb6d
Commit
17f3cb6d
authored
Apr 27, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'yum-module' of
git://github.com/Tinche/ansible
into testing_427
parents
553751ae
66bcba7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
library/yum
+30
-3
No files found.
library/yum
View file @
17f3cb6d
...
...
@@ -68,7 +68,25 @@ options:
version_added: "0.9"
default: null
aliases: []
conf_file:
description:
- The remote yum configuration file to use for the transaction.
required: false
version_added: "0.6"
default: null
aliases: []
disable_gpg_check:
description:
- Whether to disable the GPG checking of signatures of packages being
installed. Has an effect only if state is I(present) or I(latest).
required: false
version_added: "1.2"
default: "no"
choices: ["yes", "no"]
aliases: []
examples:
- code: yum name=httpd state=latest
- code: yum name=httpd state=removed
...
...
@@ -564,7 +582,8 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
module
.
exit_json
(
**
res
)
def
ensure
(
module
,
state
,
pkgspec
,
conf_file
,
enablerepo
,
disablerepo
):
def
ensure
(
module
,
state
,
pkgspec
,
conf_file
,
enablerepo
,
disablerepo
,
disable_gpg_check
):
# take multiple args comma separated
items
=
pkgspec
.
split
(
','
)
...
...
@@ -614,10 +633,14 @@ def ensure(module, state, pkgspec, conf_file, enablerepo, disablerepo):
module
.
fail_json
(
msg
=
"Error accessing repos:
%
s"
%
e
)
if
state
in
[
'installed'
,
'present'
]:
if
disable_gpg_check
:
yum_basecmd
.
append
(
'--nogpgcheck'
)
install
(
module
,
items
,
repoq
,
yum_basecmd
,
conf_file
,
en_repos
,
dis_repos
)
elif
state
in
[
'removed'
,
'absent'
]:
remove
(
module
,
items
,
repoq
,
yum_basecmd
,
conf_file
,
en_repos
,
dis_repos
)
elif
state
==
'latest'
:
if
disable_gpg_check
:
yum_basecmd
.
append
(
'--nogpgcheck'
)
latest
(
module
,
items
,
repoq
,
yum_basecmd
,
conf_file
,
en_repos
,
dis_repos
)
# should be caught by AnsibleModule argument_spec
...
...
@@ -645,6 +668,8 @@ def main():
disablerepo
=
dict
(),
list
=
dict
(),
conf_file
=
dict
(
default
=
None
),
disable_gpg_check
=
dict
(
required
=
False
,
default
=
"no"
,
choices
=
BOOLEANS
,
type
=
'bool'
),
),
required_one_of
=
[[
'name'
,
'list'
]],
mutually_exclusive
=
[[
'name'
,
'list'
]],
...
...
@@ -664,7 +689,9 @@ def main():
state
=
params
[
'state'
]
enablerepo
=
params
.
get
(
'enablerepo'
,
''
)
disablerepo
=
params
.
get
(
'disablerepo'
,
''
)
res
=
ensure
(
module
,
state
,
pkg
,
params
[
'conf_file'
],
enablerepo
,
disablerepo
)
disable_gpg_check
=
params
[
'disable_gpg_check'
]
res
=
ensure
(
module
,
state
,
pkg
,
params
[
'conf_file'
],
enablerepo
,
disablerepo
,
disable_gpg_check
)
module
.
fail_json
(
msg
=
"we should never get here unless this all failed"
,
**
res
)
# this is magic, see lib/ansible/module_common.py
...
...
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