23 lines
520 B
YAML
23 lines
520 B
YAML
---
|
|
## Register output of whoami
|
|
- name: Who am I
|
|
ansible.builtin.command: whoami
|
|
register: _my_whoiam_var
|
|
|
|
## Displays variable as to stdout
|
|
- name: Debug
|
|
ansible.builtin.debug:
|
|
var: _my_whoiam_var.stdout
|
|
|
|
## Check if can write on tmp
|
|
- name: Check write operation
|
|
ansible.builtin.copy:
|
|
content: "Hello world"
|
|
dest: /tmp/{{ _my_whoiam_var.stdout}}.hello-world.txt
|
|
|
|
## Cleans up
|
|
- name: Clean up
|
|
ansible.builtin.file:
|
|
path: /tmp/{{ _my_whoiam_var.stdout}}.hello-world.txt
|
|
state: absent
|
|
|