ansible/test/integration/targets/playbook/user.yml
Rick Elrod bd1acb74c8
[playbook/play.py] Increase error test coverage (#74217)
Change:
- Mostly increase error coverage for various conditions in play.py
- Also fix a string in an error, where get_name() was called before
  self.name was read in, so get_name() was always ''.

Test Plan:
- new tests

Signed-off-by: Rick Elrod <rick@elrod.me>

* Fix regex for py2 and py3

Signed-off-by: Rick Elrod <rick@elrod.me>

* py2 hates me

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-13 11:22:02 -04:00

23 lines
404 B
YAML

- hosts: localhost
tasks:
- command: whoami
register: whoami
- assert:
that:
- whoami is successful
- set_fact:
me: "{{ whoami.stdout }}"
- hosts: localhost
user: "{{ me }}"
tasks:
- debug:
msg: worked with user ({{ me }})
- hosts: localhost
remote_user: "{{ me }}"
tasks:
- debug:
msg: worked with remote_user ({{ me }})