issue #409: add stub LXC test, refactor playbooks.
parent
e832ddec13
commit
0e8f451190
@ -0,0 +1,17 @@
|
|||||||
|
# End the play if we're not on Linux and a raw 'sudo' command isn't available.
|
||||||
|
# Expects connection:local
|
||||||
|
|
||||||
|
- shell: uname -s
|
||||||
|
register: out
|
||||||
|
|
||||||
|
- meta: end_play
|
||||||
|
when: out.stdout != 'Linux'
|
||||||
|
|
||||||
|
- command: sudo -n whoami
|
||||||
|
args:
|
||||||
|
warn: false
|
||||||
|
ignore_errors: true
|
||||||
|
register: sudo_available
|
||||||
|
|
||||||
|
- meta: end_play
|
||||||
|
when: sudo_available.rc != 0
|
@ -1,2 +1,3 @@
|
|||||||
- import_playbook: kubectl.yml
|
- import_playbook: kubectl.yml
|
||||||
- import_playbook: setns_lxc.yml
|
- import_playbook: setns_lxc.yml
|
||||||
|
- import_playbook: setns_lxd.yml
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
# issue #409.
|
||||||
|
# setns is hard -- it wants to do superuser syscalls, so we must run it in a
|
||||||
|
# child Ansible via sudo. But that only works if sudo works.
|
||||||
|
|
||||||
|
- name: integration/stub_connections/setns_lxc.yml
|
||||||
|
hosts: test-targets
|
||||||
|
gather_facts: false
|
||||||
|
any_errors_fatal: false
|
||||||
|
connection: local
|
||||||
|
tasks:
|
||||||
|
- include_tasks: _end_play_if_not_sudo_linux.yml
|
||||||
|
|
||||||
|
- command: |
|
||||||
|
sudo -nE ansible
|
||||||
|
-i localhost,
|
||||||
|
-c setns
|
||||||
|
-e mitogen_kind=lxd
|
||||||
|
-e mitogen_lxc_info_path=stub-lxc.py
|
||||||
|
-m shell
|
||||||
|
-a "echo hi"
|
||||||
|
localhost
|
||||||
|
args:
|
||||||
|
chdir: ../..
|
||||||
|
warn: false
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that: result.rc == 0
|
||||||
|
|
Loading…
Reference in New Issue