issue #409: make setns test to work anywhere sudo works.

issue260
David Wilson 6 years ago
parent 48942a8a30
commit a77f07659e

@ -6,12 +6,21 @@
- name: integration/stub_connections/setns_lxc.yml - name: integration/stub_connections/setns_lxc.yml
hosts: test-targets hosts: test-targets
gather_facts: false gather_facts: false
any_errors_fatal: true any_errors_fatal: false
connection: local connection: local
tasks: tasks:
- setup: - setup:
register: out register: out
- debug: msg={{out}}
- command: sudo whoami
args:
warn: false
ignore_errors: true
register: sudo_available
when: out.ansible_facts.ansible_system == 'Linux'
- command: | - command: |
sudo -E ansible sudo -E ansible
-i localhost, -i localhost,
@ -24,7 +33,14 @@
args: args:
chdir: ../.. chdir: ../..
warn: false 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)
# TODO: we don't know if sudo works on this machine, so hard wire it for
# me and for Travis CI.
when: out.ansible_facts.ansible_user_id in ['dmw', 'travis']

Loading…
Cancel
Save