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
8097fd18
Commit
8097fd18
authored
Feb 17, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'make pep8' is now clean
parent
9cf66f43
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
28 additions
and
26 deletions
+28
-26
library/apt_key
+0
-0
library/ec2
+1
-3
library/ec2_facts
+6
-9
library/fireball
+0
-0
library/mongodb_user
+0
-0
library/nagios
+0
-0
library/service
+0
-0
library/setup
+0
-0
library/sysctl
+1
-4
library/uri
+0
-0
library/user
+20
-10
No files found.
library/apt_key
View file @
8097fd18
library/ec2
View file @
8097fd18
...
@@ -219,9 +219,7 @@ def main():
...
@@ -219,9 +219,7 @@ def main():
}
}
instances
.
append
(
d
)
instances
.
append
(
d
)
result
=
{
"changed"
:
True
,
module
.
exit_json
(
changed
=
True
,
instances
=
instances
)
"instances"
:
instances
}
module
.
exit_json
(
**
result
)
# this is magic, see lib/ansible/module_common.py
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
...
...
library/ec2_facts
View file @
8097fd18
...
@@ -73,7 +73,8 @@ class Ec2Metadata(object):
...
@@ -73,7 +73,8 @@ class Ec2Metadata(object):
for
pattern
in
filter_patterns
:
for
pattern
in
filter_patterns
:
for
key
in
new_fields
.
keys
():
for
key
in
new_fields
.
keys
():
match
=
re
.
search
(
pattern
,
key
)
match
=
re
.
search
(
pattern
,
key
)
if
match
:
new_fields
.
pop
(
key
)
if
match
:
new_fields
.
pop
(
key
)
return
new_fields
return
new_fields
def
fetch
(
self
,
uri
,
recurse
=
True
):
def
fetch
(
self
,
uri
,
recurse
=
True
):
...
@@ -103,23 +104,19 @@ class Ec2Metadata(object):
...
@@ -103,23 +104,19 @@ class Ec2Metadata(object):
newkey
=
key
.
replace
(
':'
,
'_'
)
.
replace
(
'-'
,
'_'
)
newkey
=
key
.
replace
(
':'
,
'_'
)
.
replace
(
'-'
,
'_'
)
data
[
newkey
]
=
value
data
[
newkey
]
=
value
def
run
(
self
):
def
run
(
self
):
self
.
fetch
(
self
.
uri_meta
)
# populate _data
self
.
fetch
(
self
.
uri_meta
)
# populate _data
data
=
self
.
_mangle_fields
(
self
.
_data
,
data
=
self
.
_mangle_fields
(
self
.
_data
,
self
.
uri_meta
)
self
.
uri_meta
)
data
[
self
.
_prefix
%
'user-data'
]
=
self
.
_fetch
(
self
.
uri_user
)
data
[
self
.
_prefix
%
'user-data'
]
=
self
.
_fetch
(
self
.
uri_user
)
data
[
self
.
_prefix
%
'public-key'
]
=
self
.
_fetch
(
self
.
uri_ssh
)
data
[
self
.
_prefix
%
'public-key'
]
=
self
.
_fetch
(
self
.
uri_ssh
)
self
.
fix_invalid_varnames
(
data
)
self
.
fix_invalid_varnames
(
data
)
return
data
return
data
def
main
():
def
main
():
ec2_facts
=
Ec2Metadata
()
.
run
()
ec2_facts
=
Ec2Metadata
()
.
run
()
ec2_facts_result
=
{
ec2_facts_result
=
dict
(
changed
=
False
,
ansible_facts
=
ec2_facts
)
"changed"
:
False
,
"ansible_facts"
:
ec2_facts
}
module
=
AnsibleModule
(
module
=
AnsibleModule
(
argument_spec
=
dict
()
argument_spec
=
dict
()
)
)
...
...
library/fireball
View file @
8097fd18
library/mongodb_user
View file @
8097fd18
library/nagios
View file @
8097fd18
library/service
View file @
8097fd18
library/setup
View file @
8097fd18
library/sysctl
View file @
8097fd18
...
@@ -120,11 +120,8 @@ def write_sysctl(module, lines, **sysctl_args):
...
@@ -120,11 +120,8 @@ def write_sysctl(module, lines, **sysctl_args):
# ==============================================================
# ==============================================================
def
sysctl_args_expand
(
**
sysctl_args
):
def
sysctl_args_expand
(
**
sysctl_args
):
# key_path
sysctl_args
[
'key_path'
]
=
sysctl_args
[
'name'
]
.
replace
(
'.'
,
'/'
)
sysctl_args
[
'key_path'
]
=
sysctl_args
[
'name'
]
.
replace
(
'.'
,
'/'
)
sysctl_args
[
'key_path'
]
=
'/proc/sys/'
+
sysctl_args
[
'key_path'
];
sysctl_args
[
'key_path'
]
=
'/proc/sys/'
+
sysctl_args
[
'key_path'
]
# end
return
sysctl_args
return
sysctl_args
# ==============================================================
# ==============================================================
...
...
library/uri
View file @
8097fd18
library/user
View file @
8097fd18
...
@@ -508,20 +508,24 @@ class FreeBsdUser(User):
...
@@ -508,20 +508,24 @@ class FreeBsdUser(User):
SHADOWFILE
=
'/etc/master.passwd'
SHADOWFILE
=
'/etc/master.passwd'
def
remove_user
(
self
):
def
remove_user
(
self
):
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'userdel'
,
'userdel'
,
'-n'
,
'-n'
,
self
.
name
]
self
.
name
]
if
self
.
remove
:
if
self
.
remove
:
cmd
.
append
(
'-r'
)
cmd
.
append
(
'-r'
)
return
self
.
execute_command
(
cmd
)
return
self
.
execute_command
(
cmd
)
def
create_user
(
self
):
def
create_user
(
self
):
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'useradd'
,
'useradd'
,
'-n'
,
'-n'
,
self
.
name
]
self
.
name
]
if
self
.
uid
is
not
None
:
if
self
.
uid
is
not
None
:
cmd
.
append
(
'-u'
)
cmd
.
append
(
'-u'
)
...
@@ -563,19 +567,23 @@ class FreeBsdUser(User):
...
@@ -563,19 +567,23 @@ class FreeBsdUser(User):
# we have to set the password in a second command
# we have to set the password in a second command
if
self
.
password
is
not
None
:
if
self
.
password
is
not
None
:
cmd
=
[
self
.
module
.
get_bin_path
(
'chpass'
,
True
),
cmd
=
[
self
.
module
.
get_bin_path
(
'chpass'
,
True
),
'-p'
,
'-p'
,
self
.
password
,
self
.
password
,
self
.
name
]
self
.
name
]
return
self
.
execute_command
(
cmd
)
return
self
.
execute_command
(
cmd
)
return
(
rc
,
out
,
err
)
return
(
rc
,
out
,
err
)
def
modify_user
(
self
):
def
modify_user
(
self
):
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'usermod'
,
'usermod'
,
'-n'
,
'-n'
,
self
.
name
]
self
.
name
]
cmd_len
=
len
(
cmd
)
cmd_len
=
len
(
cmd
)
info
=
self
.
user_info
()
info
=
self
.
user_info
()
...
@@ -639,10 +647,12 @@ class FreeBsdUser(User):
...
@@ -639,10 +647,12 @@ class FreeBsdUser(User):
# we have to set the password in a second command
# we have to set the password in a second command
if
self
.
password
is
not
None
and
info
[
1
]
!=
self
.
password
:
if
self
.
password
is
not
None
and
info
[
1
]
!=
self
.
password
:
cmd
=
[
self
.
module
.
get_bin_path
(
'chpass'
,
True
),
cmd
=
[
self
.
module
.
get_bin_path
(
'chpass'
,
True
),
'-p'
,
'-p'
,
self
.
password
,
self
.
password
,
self
.
name
]
self
.
name
]
return
self
.
execute_command
(
cmd
)
return
self
.
execute_command
(
cmd
)
return
(
rc
,
out
,
err
)
return
(
rc
,
out
,
err
)
...
...
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