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
959138d0
Commit
959138d0
authored
Aug 27, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added accelerate_port to plays, and made it configurable
parent
167f1850
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
19 deletions
+33
-19
examples/ansible.cfg
+2
-1
lib/ansible/constants.py
+1
-1
lib/ansible/playbook/__init__.py
+3
-2
lib/ansible/playbook/play.py
+3
-2
lib/ansible/runner/__init__.py
+10
-1
lib/ansible/runner/connection_plugins/fireball2.py
+13
-11
library/utilities/fireball2
+1
-1
No files found.
examples/ansible.cfg
View file @
959138d0
...
...
@@ -112,4 +112,5 @@ filter_plugins = /usr/share/ansible_plugins/filter_plugins
# (default is sftp)
#scp_if_ssh = True
[accelerate]
accelerate_port = 5099
lib/ansible/constants.py
View file @
959138d0
...
...
@@ -132,7 +132,7 @@ ANSIBLE_NOCOWS = get_config(p, DEFAULTS, 'nocows', 'ANSIBLE_NOCO
ANSIBLE_SSH_ARGS
=
get_config
(
p
,
'ssh_connection'
,
'ssh_args'
,
'ANSIBLE_SSH_ARGS'
,
None
)
PARAMIKO_RECORD_HOST_KEYS
=
get_config
(
p
,
'paramiko_connection'
,
'record_host_keys'
,
'ANSIBLE_PARAMIKO_RECORD_HOST_KEYS'
,
True
,
boolean
=
True
)
ZEROMQ_PORT
=
int
(
get_config
(
p
,
'fireball_connection'
,
'zeromq_port'
,
'ANSIBLE_ZEROMQ_PORT'
,
5099
))
FIREBALL2_PORT
=
int
(
get_config
(
p
,
'fireball_connection'
,
'fireball2_port'
,
'ANSIBLE_FIREBALL2
_PORT'
,
5099
))
ACCELERATE_PORT
=
int
(
get_config
(
p
,
'accelerate'
,
'accelerate_port'
,
'ACCELERATE
_PORT'
,
5099
))
DEFAULT_UNDEFINED_VAR_BEHAVIOR
=
get_config
(
p
,
DEFAULTS
,
'error_on_undefined_vars'
,
'ANSIBLE_ERROR_ON_UNDEFINED_VARS'
,
True
,
boolean
=
True
)
HOST_KEY_CHECKING
=
get_config
(
p
,
DEFAULTS
,
'host_key_checking'
,
'ANSIBLE_HOST_KEY_CHECKING'
,
True
,
boolean
=
True
)
...
...
lib/ansible/playbook/__init__.py
View file @
959138d0
...
...
@@ -312,7 +312,8 @@ class PlayBook(object):
conditional
=
task
.
only_if
,
callbacks
=
self
.
runner_callbacks
,
sudo
=
task
.
sudo
,
sudo_user
=
task
.
sudo_user
,
transport
=
task
.
transport
,
sudo_pass
=
task
.
sudo_pass
,
is_playbook
=
True
,
check
=
self
.
check
,
diff
=
self
.
diff
,
environment
=
task
.
environment
,
complex_args
=
task
.
args
,
accelerate
=
task
.
play
.
accelerate
,
check
=
self
.
check
,
diff
=
self
.
diff
,
environment
=
task
.
environment
,
complex_args
=
task
.
args
,
accelerate
=
task
.
play
.
accelerate
,
accelerate_port
=
task
.
play
.
accelerate_port
,
error_on_undefined_vars
=
C
.
DEFAULT_UNDEFINED_VAR_BEHAVIOR
)
...
...
@@ -447,7 +448,7 @@ class PlayBook(object):
remote_pass
=
self
.
remote_pass
,
remote_port
=
play
.
remote_port
,
private_key_file
=
self
.
private_key_file
,
setup_cache
=
self
.
SETUP_CACHE
,
callbacks
=
self
.
runner_callbacks
,
sudo
=
play
.
sudo
,
sudo_user
=
play
.
sudo_user
,
transport
=
play
.
transport
,
sudo_pass
=
self
.
sudo_pass
,
is_playbook
=
True
,
module_vars
=
play
.
vars
,
check
=
self
.
check
,
diff
=
self
.
diff
,
accelerate
=
play
.
accelerate
check
=
self
.
check
,
diff
=
self
.
diff
,
accelerate
=
play
.
accelerate
,
accelerate_port
=
play
.
accelerate_port
)
.
run
()
self
.
stats
.
compute
(
setup_results
,
setup
=
True
)
...
...
lib/ansible/playbook/play.py
View file @
959138d0
...
...
@@ -29,7 +29,7 @@ class Play(object):
__slots__
=
[
'hosts'
,
'name'
,
'vars'
,
'vars_prompt'
,
'vars_files'
,
'handlers'
,
'remote_user'
,
'remote_port'
,
'accelerate'
,
'handlers'
,
'remote_user'
,
'remote_port'
,
'accelerate'
,
'accelerate_port'
,
'sudo'
,
'sudo_user'
,
'transport'
,
'playbook'
,
'tags'
,
'gather_facts'
,
'serial'
,
'_ds'
,
'_handlers'
,
'_tasks'
,
'basedir'
,
'any_errors_fatal'
,
'roles'
,
'max_fail_pct'
...
...
@@ -39,7 +39,7 @@ class Play(object):
# and don't line up 1:1 with how they are stored
VALID_KEYS
=
[
'hosts'
,
'name'
,
'vars'
,
'vars_prompt'
,
'vars_files'
,
'tasks'
,
'handlers'
,
'user'
,
'port'
,
'include'
,
'accelerate'
,
'tasks'
,
'handlers'
,
'user'
,
'port'
,
'include'
,
'accelerate'
,
'accelerate_port'
,
'sudo'
,
'sudo_user'
,
'connection'
,
'tags'
,
'gather_facts'
,
'serial'
,
'any_errors_fatal'
,
'roles'
,
'pre_tasks'
,
'post_tasks'
,
'max_fail_percentage'
]
...
...
@@ -104,6 +104,7 @@ class Play(object):
self
.
remote_port
=
self
.
remote_port
self
.
any_errors_fatal
=
ds
.
get
(
'any_errors_fatal'
,
False
)
self
.
accelerate
=
ds
.
get
(
'accelerate'
,
False
)
self
.
accelerate_port
=
ds
.
get
(
'accelerate_port'
,
None
)
self
.
max_fail_pct
=
int
(
ds
.
get
(
'max_fail_percentage'
,
100
))
load_vars
=
{}
...
...
lib/ansible/runner/__init__.py
View file @
959138d0
...
...
@@ -140,6 +140,7 @@ class Runner(object):
complex_args
=
None
,
# structured data in addition to module_args, must be a dict
error_on_undefined_vars
=
C
.
DEFAULT_UNDEFINED_VAR_BEHAVIOR
,
# ex. False
accelerate
=
False
,
# use fireball acceleration
accelerate_port
=
None
,
# port to use with fireball acceleration
):
# used to lock multiprocess inputs and outputs at various levels
...
...
@@ -181,12 +182,15 @@ class Runner(object):
self
.
complex_args
=
complex_args
self
.
error_on_undefined_vars
=
error_on_undefined_vars
self
.
accelerate
=
accelerate
self
.
accelerate_port
=
accelerate_port
self
.
callbacks
.
runner
=
self
if
self
.
accelerate
:
# if we're using accelerated mode, force the local
# transport to fireball2
self
.
transport
=
"fireball2"
if
not
self
.
accelerate_port
:
self
.
accelerate_port
=
C
.
ACCELERATE_PORT
elif
self
.
transport
==
'smart'
:
# if the transport is 'smart' see if SSH can support ControlPersist if not use paramiko
# 'smart' is the default since 1.2.1/1.3
...
...
@@ -606,7 +610,12 @@ class Runner(object):
inject
[
'ansible_ssh_user'
]
=
actual_user
try
:
if
actual_port
is
not
None
:
if
self
.
transport
==
'fireball2'
:
# for fireball2, we stuff both ports into a single
# variable so that we don't have to mangle other function
# calls just to accomodate this one case
actual_port
=
[
port
,
self
.
accelerate_port
]
elif
actual_port
is
not
None
:
actual_port
=
int
(
actual_port
)
except
ValueError
,
e
:
result
=
dict
(
failed
=
True
,
msg
=
"FAILED: Configured port
\"
%
s
\"
is not a valid port, expected integer"
%
actual_port
)
...
...
lib/ansible/runner/connection_plugins/fireball2.py
View file @
959138d0
...
...
@@ -31,29 +31,31 @@ class Connection(object):
def
__init__
(
self
,
runner
,
host
,
port
,
user
,
password
,
private_key_file
,
*
args
,
**
kwargs
):
self
.
ssh
=
SSHConnection
(
runner
=
runner
,
host
=
host
,
port
=
port
,
user
=
user
,
password
=
password
,
private_key_file
=
private_key_file
)
self
.
runner
=
runner
self
.
host
=
host
self
.
context
=
None
self
.
conn
=
None
self
.
user
=
user
self
.
key
=
utils
.
key_for_hostname
(
host
)
self
.
fbport
=
constants
.
FIREBALL2_PORT
self
.
port
=
port
[
0
]
self
.
fbport
=
port
[
1
]
self
.
is_connected
=
False
self
.
ssh
=
SSHConnection
(
runner
=
self
.
runner
,
host
=
self
.
host
,
port
=
self
.
port
,
user
=
self
.
user
,
password
=
password
,
private_key_file
=
private_key_file
)
# attempt to work around shared-memory funness
if
getattr
(
self
.
runner
,
'aes_keys'
,
None
):
utils
.
AES_KEYS
=
self
.
runner
.
aes_keys
def
_execute_fb_module
(
self
):
args
=
"password=
%
s
"
%
base64
.
b64encode
(
self
.
key
.
__str__
(
))
args
=
"password=
%
s
port=
%
s"
%
(
base64
.
b64encode
(
self
.
key
.
__str__
()),
str
(
self
.
fbport
))
self
.
ssh
.
connect
()
tmp_path
=
self
.
runner
.
_make_tmp_path
(
self
.
ssh
)
return
self
.
runner
.
_execute_module
(
self
.
ssh
,
tmp_path
,
'fireball2'
,
args
,
inject
=
{
"password"
:
self
.
key
})
...
...
library/utilities/fireball2
View file @
959138d0
...
...
@@ -299,7 +299,7 @@ def main():
)
password
=
base64
.
b64decode
(
module
.
params
[
'password'
])
port
=
module
.
params
[
'port'
]
port
=
int
(
module
.
params
[
'port'
])
minutes
=
int
(
module
.
params
[
'minutes'
])
if
not
HAS_KEYCZAR
:
...
...
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