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
119d7cd8
Commit
119d7cd8
authored
May 14, 2012
by
Wes Johnson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from wgjohnson/get_selinux_facts
starting fresh, doing it 'right'
parents
776fe43d
d67f996f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
library/setup
+24
-0
No files found.
library/setup
View file @
119d7cd8
...
...
@@ -267,8 +267,32 @@ def get_public_ssh_host_keys(facts):
else
:
facts
[
'ssh_host_key_rsa_public'
]
=
rsa
.
split
()[
1
]
def
get_selinux_facts
(
facts
):
if
os
.
path
.
exists
(
"/usr/sbin/sestatus"
):
cmd
=
subprocess
.
Popen
(
"/usr/sbin/sestatus"
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
cmd
.
communicate
()
if
err
==
''
:
facts
[
'selinux'
]
=
{}
list
=
out
.
split
(
"
\n
"
)
status
=
re
.
search
(
"(enabled|disabled)"
,
list
[
0
])
if
status
.
group
()
==
"enabled"
:
mode
=
re
.
search
(
"(enforcing|disabled|permissive)"
,
list
[
2
])
config_mode
=
re
.
search
(
"(enforcing|disabled|permissive)"
,
list
[
3
])
policyvers
=
re
.
search
(
"
\
d+"
,
list
[
4
])
type
=
re
.
search
(
"(targeted|strict|mls)"
,
list
[
5
])
facts
[
'selinux'
][
'status'
]
=
status
.
group
()
facts
[
'selinux'
][
'mode'
]
=
mode
.
group
()
facts
[
'selinux'
][
'config_mode'
]
=
config_mode
.
group
()
facts
[
'selinux'
][
'policyvers'
]
=
policyvers
.
group
()
facts
[
'selinux'
][
'type'
]
=
type
.
group
()
elif
status
.
group
()
==
"disabled"
:
facts
[
'selinux'
][
'status'
]
=
status
.
group
()
else
:
facts
[
'selinux'
]
=
False
def
get_service_facts
(
facts
):
get_public_ssh_host_keys
(
facts
)
get_selinux_facts
(
facts
)
def
ansible_facts
():
facts
=
{}
...
...
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