Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
4691ce0b
Commit
4691ce0b
authored
Mar 17, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue #150: ansible: add basic Docker support.
parent
b64e52b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
8 deletions
+32
-8
ansible_mitogen/connection.py
ansible_mitogen/connection.py
+22
-5
ansible_mitogen/strategy.py
ansible_mitogen/strategy.py
+1
-1
docs/ansible.rst
docs/ansible.rst
+9
-0
mitogen/docker.py
mitogen/docker.py
+0
-2
No files found.
ansible_mitogen/connection.py
View file @
4691ce0b
...
...
@@ -160,6 +160,18 @@ class Connection(ansible.plugins.connection.ConnectionBase):
})
)
def
_connect_docker
(
self
):
return
mitogen
.
service
.
call
(
self
.
parent
,
ContextService
.
handle
,
cast
({
'method'
:
'docker'
,
'container'
:
self
.
_play_context
.
remote_addr
,
'python_path'
:
self
.
python_path
,
'connect_timeout'
:
self
.
_play_context
.
timeout
,
})
)
def
_connect_sudo
(
self
,
via
=
None
,
python_path
=
None
):
"""
Fetch a reference to a sudo Context matching the play context from
...
...
@@ -212,12 +224,17 @@ class Connection(ansible.plugins.connection.ConnectionBase):
self
.
context
=
self
.
_connect_sudo
(
python_path
=
sys
.
executable
)
else
:
self
.
context
=
self
.
_connect_local
()
else
:
return
if
self
.
original_transport
==
'docker'
:
self
.
host
=
self
.
_connect_docker
()
elif
self
.
original_transport
==
'ssh'
:
self
.
host
=
self
.
_connect_ssh
()
if
self
.
_play_context
.
become
:
self
.
context
=
self
.
_connect_sudo
(
via
=
self
.
host
)
else
:
self
.
context
=
self
.
host
if
self
.
_play_context
.
become
:
self
.
context
=
self
.
_connect_sudo
(
via
=
self
.
host
)
else
:
self
.
context
=
self
.
host
def
close
(
self
):
"""
...
...
ansible_mitogen/strategy.py
View file @
4691ce0b
...
...
@@ -78,7 +78,7 @@ def wrap_connection_loader__get(name, play_context, new_stdin):
an argument, so that it can emulate the original type.
"""
kwargs
=
{}
if
name
in
(
'ssh'
,
'local'
):
if
name
in
(
'ssh'
,
'local'
,
'docker'
):
kwargs
[
'original_transport'
]
=
name
name
=
'mitogen'
return
connection_loader__get
(
name
,
play_context
,
new_stdin
,
**
kwargs
)
...
...
docs/ansible.rst
View file @
4691ce0b
...
...
@@ -258,6 +258,15 @@ Sudo Variables
* ansible.cfg: timeout
Docker Variables
----------------
Note: Docker support is only intended for developer testing, it might disappear
entirely prior to a stable release.
* ansible_host
Chat on IRC
-----------
...
...
mitogen/docker.py
View file @
4691ce0b
...
...
@@ -61,6 +61,4 @@ class Stream(mitogen.parent.Stream):
elif
self
.
image
:
bits
+=
[
'run'
,
'-i'
,
'--rm'
,
self
.
image
]
bits
+=
super
(
Stream
,
self
).
get_boot_command
()
LOG
.
debug
(
'Docker command line: %r'
,
bits
)
print
bits
return
bits
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