generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
458cf6c
commit af3da9e
Showing
5 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
shippable/posix/group4 | ||
destructive | ||
needs/root | ||
skip/docker # we need a VM, and not a container |
4 changes: 4 additions & 0 deletions
4
tests/integration/targets/generic_ssh_connection/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
dependencies: | ||
- setup_docker | ||
- setup_paramiko |
77 changes: 77 additions & 0 deletions
77
tests/integration/targets/generic_ssh_connection/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
#################################################################### | ||
# WARNING: These are designed specifically for Ansible tests # | ||
# and should not be used as examples of how to write Ansible roles # | ||
#################################################################### | ||
|
||
- name: Get docker daemon information directly | ||
docker_host_info: | ||
register: output | ||
|
||
- name: Make sure we got information | ||
assert: | ||
that: | ||
- 'output.host_info.Name is string' | ||
- 'output.containers is not defined' | ||
- 'output.networks is not defined' | ||
- 'output.volumes is not defined' | ||
- 'output.images is not defined' | ||
- 'output.disk_usage is not defined' | ||
|
||
- name: Show contents of ~/.ssh | ||
command: ls -lah ~/.ssh | ||
ignore_errors: true | ||
|
||
- name: Create SSH config | ||
copy: | ||
dest: "{{ lookup('env', 'HOME') }}/.ssh/config" | ||
mode: '0600' | ||
content: | | ||
Host localhost | ||
User root | ||
IdentityFile ~/.ssh/id_rsa | ||
- name: Get docker daemon information via ssh (paramiko) to localhost | ||
docker_host_info: | ||
docker_host: "ssh://root@localhost" | ||
register: output | ||
ignore_errors: true | ||
|
||
- name: Make sure we got information | ||
assert: | ||
that: | ||
- 'output.host_info.Name is string' | ||
- 'output.containers is not defined' | ||
- 'output.networks is not defined' | ||
- 'output.volumes is not defined' | ||
- 'output.images is not defined' | ||
- 'output.disk_usage is not defined' | ||
when: output is succeeded or 'Install paramiko package to enable' in output.msg | ||
# For whatever reason, even though paramiko is installed, *sometimes* this error | ||
# shows up. I have no idea why it sometimes works and sometimes not... | ||
|
||
- name: Get docker daemon information via ssh (OpenSSH) to localhost | ||
docker_host_info: | ||
docker_host: "ssh://root@localhost" | ||
use_ssh_client: true | ||
register: output | ||
ignore_errors: true | ||
|
||
- name: Make sure we got information | ||
assert: | ||
that: | ||
- output is succeeded | ||
- 'output.host_info.Name is string' | ||
- 'output.containers is not defined' | ||
- 'output.networks is not defined' | ||
- 'output.volumes is not defined' | ||
- 'output.images is not defined' | ||
- 'output.disk_usage is not defined' | ||
when: docker_py_version is version('4.4.0', '>=') | ||
|
||
- name: Make sure we got information | ||
assert: | ||
that: | ||
- output is failed | ||
- "'use_ssh_client=True requires Docker SDK for Python 4.4.0 or newer' in output.msg" | ||
when: docker_py_version is version('4.4.0', '<') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
dependencies: | ||
- setup_remote_constraints | ||
- setup_openssl # so cryptography is installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Install paramiko | ||
pip: | ||
name: "paramiko{% if cryptography_version.stdout is version('2.5.0', '<') %}<2.5.0{% endif %}" | ||
extra_args: "-c {{ remote_constraints }}" | ||
become: true |