Add alchemy.yml
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- name: Simple Non-Root Playbook
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: 1. Check who is running the playbook
|
||||||
|
ansible.builtin.command: whoami
|
||||||
|
register: user_check
|
||||||
|
|
||||||
|
- name: 2. Print the username to the console
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "This playbook is running as user {{ user_check.stdout }}"
|
||||||
|
|
||||||
|
- name: 3. Create a test file in the home directory
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "Hello, this file was created using Ansible without sudo!"
|
||||||
|
dest: "~/ansible_test_file.txt"
|
||||||
|
|
||||||
|
- name: 4. Verify the file contents
|
||||||
|
ansible.builtin.command: cat ~/ansible_test_file.txt
|
||||||
|
register: file_output
|
||||||
|
|
||||||
|
- name: 5. Display the file output
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ file_output.stdout }}"
|
||||||
Reference in New Issue
Block a user