You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible/integration/stub_connections/setns_lxc.yml

47 lines
1.1 KiB
YAML

# 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:
- setup:
register: out
- debug: msg={{out}}
- command: sudo -n whoami
args:
warn: false
ignore_errors: true
register: sudo_available
when: out.ansible_facts.ansible_system == 'Linux'
- command: |
sudo -nE ansible
-i localhost,
-c setns
-e mitogen_kind=lxc
-e mitogen_lxc_info_path=stub-lxc-info.py
-m shell
-a "echo hi"
localhost
args:
chdir: ../..
warn: false
when: |
out.ansible_facts.ansible_system == 'Linux'
and sudo_available.rc == 0
register: result
- assert:
that: |
(out.ansible_facts.ansible_system != 'Linux') or
(sudo_available != 0) or
(result.rc == 0)