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
29209c49
Commit
29209c49
authored
Apr 10, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Style fixes so "make pep8" is clean.
parent
01139515
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
20 additions
and
18 deletions
+20
-18
lib/ansible/inventory/__init__.py
+0
-0
lib/ansible/playbook/__init__.py
+0
-0
lib/ansible/playbook/play.py
+1
-1
lib/ansible/utils/__init__.py
+0
-0
library/ec2
+1
-3
library/macports
+0
-0
library/nagios
+0
-0
library/openbsd_pkg
+0
-0
library/service
+0
-0
library/setup
+0
-0
library/vagrant
+18
-14
No files found.
lib/ansible/inventory/__init__.py
View file @
29209c49
lib/ansible/playbook/__init__.py
View file @
29209c49
lib/ansible/playbook/play.py
View file @
29209c49
...
...
@@ -90,7 +90,7 @@ class Play(object):
load_vars
=
{}
if
self
.
playbook
.
inventory
.
basedir
()
is
not
None
:
load_vars
[
'inventory_dir'
]
=
self
.
playbook
.
inventory
.
basedir
()
;
load_vars
[
'inventory_dir'
]
=
self
.
playbook
.
inventory
.
basedir
()
self
.
_tasks
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'tasks'
,
[]),
load_vars
)
self
.
_handlers
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'handlers'
,
[]),
load_vars
)
...
...
lib/ansible/utils/__init__.py
View file @
29209c49
library/ec2
View file @
29209c49
...
...
@@ -267,13 +267,11 @@ def main():
if
id
!=
None
:
filter_dict
=
{
'client-token'
:
id
,
'instance-state-name'
:
'running'
}
previous_reservations
=
ec2
.
get_all_instances
(
None
,
filter_dict
)
previous_reservations
=
ec2
.
get_all_instances
(
None
,
filter_dict
)
for
res
in
previous_reservations
:
for
prev_instance
in
res
.
instances
:
running_instances
.
append
(
prev_instance
)
count_remaining
=
count_remaining
-
len
(
running_instances
)
# module.fail_json(msg = "known running instances: %s" % (running_instances))
# Both min_count and max_count equal count parameter. This means the launch request is explicit (we want count, or fail) in how many instances we want.
...
...
library/macports
View file @
29209c49
library/nagios
View file @
29209c49
library/openbsd_pkg
View file @
29209c49
library/service
View file @
29209c49
library/setup
View file @
29209c49
library/vagrant
View file @
29209c49
...
...
@@ -181,7 +181,7 @@ class VagrantWrapper(object):
self
.
_deserialize
()
this_instance_dict
=
self
.
_get_instance
(
vm_name
,
icount
)
if
not
this_instance_dict
.
has_key
(
'box_name'
):
if
not
'box_name'
in
this_instance_dict
:
this_instance_dict
[
'box_name'
]
=
box_name
this_instance_dict
[
'forward_ports'
]
=
ports
...
...
@@ -205,7 +205,8 @@ class VagrantWrapper(object):
def
status
(
self
,
vm_name
=
None
,
index
=
-
1
):
'''Return the run status of the VM instance. If no instance N is given, returns first instance.'''
vm_names
=
[]
if
vm_name
!=
None
:
vm_names
=
[
vm_name
]
if
vm_name
!=
None
:
vm_names
=
[
vm_name
]
else
:
vm_names
=
self
.
_instances
()
.
keys
()
...
...
@@ -225,7 +226,8 @@ class VagrantWrapper(object):
def
config
(
self
,
vm_name
,
index
=
-
1
):
'''Return info on SSH for the running instance.'''
vm_names
=
[]
if
vm_name
!=
None
:
vm_names
=
[
vm_name
]
if
vm_name
!=
None
:
vm_names
=
[
vm_name
]
else
:
vm_names
=
self
.
_instances
()
.
keys
()
...
...
@@ -247,7 +249,8 @@ class VagrantWrapper(object):
changed
=
False
vm_names
=
[]
if
vm_name
!=
None
:
vm_names
=
[
vm_name
]
if
vm_name
!=
None
:
vm_names
=
[
vm_name
]
else
:
vm_names
=
self
.
_instances
()
.
keys
()
...
...
@@ -300,6 +303,7 @@ class VagrantWrapper(object):
#
# Helper Methods
#
def
_instances
(
self
):
return
self
.
vg_data
[
'instances'
]
...
...
@@ -308,7 +312,7 @@ class VagrantWrapper(object):
instances
=
self
.
_instances
()
inst_array
=
[]
if
instances
.
has_key
(
vm_name
)
:
if
vm_name
in
instances
:
inst_array
=
instances
[
vm_name
]
if
len
(
inst_array
)
>
index
:
...
...
@@ -393,18 +397,17 @@ class VagrantWrapper(object):
name
=
instance_dict
[
'vagrant_name'
]
ip
=
instance_dict
[
'internal_ip'
]
box_name
=
instance_dict
[
'box_name'
]
vfile
.
write
(
VAGRANT_FILE_VM_STANZA_HEAD
%
(
name
,
name
,
name
,
ip
,
name
,
box_name
)
)
if
instance_dict
.
has_key
(
'ram'
):
vfile
.
write
(
VAGRANT_FILE_MEMORY_LINE
%
(
name
,
instance_dict
[
'ram'
])
)
vfile
.
write
(
VAGRANT_FILE_HOSTNAME_LINE
%
(
name
,
name
.
replace
(
'_'
,
'-'
))
)
if
instance_dict
.
has_key
(
'forward_ports'
):
vfile
.
write
(
VAGRANT_FILE_VM_STANZA_HEAD
%
(
name
,
name
,
name
,
ip
,
name
,
box_name
))
if
'ram'
in
instance_dict
:
vfile
.
write
(
VAGRANT_FILE_MEMORY_LINE
%
(
name
,
instance_dict
[
'ram'
]))
vfile
.
write
(
VAGRANT_FILE_HOSTNAME_LINE
%
(
name
,
name
.
replace
(
'_'
,
'-'
)))
if
'forward_ports'
in
instance_dict
:
for
port
in
instance_dict
[
'forward_ports'
]:
port
=
int
(
port
)
host_port
=
port
if
port
<
1024
:
host_port
=
port
+
10000
vfile
.
write
(
VAGRANT_FILE_PORT_FORWARD_LINE
%
(
name
,
port
,
host_port
)
)
vfile
.
write
(
VAGRANT_FILE_PORT_FORWARD_LINE
%
(
name
,
port
,
host_port
))
vfile
.
write
(
VAGRANT_FILE_VM_STANZA_TAIL
)
vfile
.
write
(
VAGRANT_FILE_TAIL
)
...
...
@@ -522,14 +525,15 @@ def main():
elif
cmd
==
"config"
or
cmd
==
"conf"
:
if
vm_name
==
None
:
module
.
fail_json
(
msg
=
"Error:
you must specify a vm_name when calling config."
)
module
.
fail_json
(
msg
=
"Error:
a vm_name is required when calling config."
)
(
changd
,
cnf
)
=
vgw
.
config
(
vm_name
)
module
.
exit_json
(
changed
=
changd
,
config
=
cnf
)
elif
cmd
==
'ssh'
:
# this doesn't really seem to belong here, should just manage the VM with ansible -- MPD
if
vm_name
==
None
:
module
.
fail_json
(
msg
=
"Error:
you must specify a vm_name when calling ssh."
)
module
.
fail_json
(
msg
=
"Error:
a vm_name is required when calling ssh."
)
(
changd
,
cnf
)
=
vgw
.
config
(
vm_name
)
sshcmd
=
"ssh -i
%
s -p
%
s
%
s@
%
s"
%
(
cnf
[
"IdentityFile"
],
cnf
[
"Port"
],
cnf
[
"User"
],
cnf
[
"HostName"
])
...
...
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