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
5da4ab2d
Commit
5da4ab2d
authored
Sep 17, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1051 from sfromm/wile-e-coyote
Add pkg_mgr fact to setup (take 2)
parents
d5b8553d
65fe7b70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
library/setup
+14
-0
No files found.
library/setup
View file @
5da4ab2d
...
...
@@ -54,6 +54,13 @@ class Facts(object):
'/etc/vmware-release'
:
'VMwareESX'
}
SELINUX_MODE_DICT
=
{
1
:
'enforcing'
,
0
:
'permissive'
,
-
1
:
'disabled'
}
# A list of dicts. If there is a platform with more than one
# package manager, put the preferred one last. If there is an
# ansible module, use that as the value for the 'name' key.
PKG_MGRS
=
[
{
'path'
:
'/usr/bin/yum'
,
'name'
:
'yum'
},
{
'path'
:
'/usr/bin/apt-get'
,
'name'
:
'apt'
},
{
'path'
:
'/usr/bin/zypper'
,
'name'
:
'zypper'
}
]
def
__init__
(
self
):
self
.
facts
=
{}
self
.
get_platform_facts
()
...
...
@@ -61,6 +68,7 @@ class Facts(object):
self
.
get_cmdline
()
self
.
get_public_ssh_host_keys
()
self
.
get_selinux_facts
()
self
.
get_pkg_mgr_facts
()
def
populate
(
self
):
return
self
.
facts
...
...
@@ -133,6 +141,12 @@ class Facts(object):
else
:
self
.
facts
[
'ssh_host_key_rsa_public'
]
=
rsa
.
split
()[
1
]
def
get_pkg_mgr_facts
(
self
):
self
.
facts
[
'pkg_mgr'
]
=
'unknown'
for
pkg
in
Facts
.
PKG_MGRS
:
if
os
.
path
.
exists
(
pkg
[
'path'
]):
self
.
facts
[
'pkg_mgr'
]
=
pkg
[
'name'
]
def
get_selinux_facts
(
self
):
if
not
HAVE_SELINUX
:
self
.
facts
[
'selinux'
]
=
False
...
...
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