An Ansible playbook needs completion on the jump host, where a team member left off. Below are the details:
The inventory file /home/thor/ansible/inventory requires adjustments. The playbook must run on App Server 1 in Stratos DC. Update the inventory accordingly.
Create a playbook /home/thor/ansible/playbook.yml. Include a task to create an empty file /tmp/file.txt on App Server 1.
Note: Validation will run the playbook using the command ansible-playbook -i inventory playbook.yml. Ensure the playbook works without any additional arguments.
First, update the /home/thor/ansible/inventory
file to include App Server 1
under the Stratos DC
group.
stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_ssh_pass=Ir0nM@n
Create the playbook at /home/thor/ansible/playbook.yml
with the following content:
---
- name: Create an empty file on App Server 1
hosts: stapp01
tasks:
- name: Ensure /tmp/file.txt exists
file:
path: /tmp/file.txt
state: touch
Ensure the playbook and inventory file are correctly placed and configured. To validate that everything is set up correctly, run:
ansible-playbook -i /home/thor/ansible/inventory /home/thor/ansible/playbook.yml
This command will execute the playbook using the inventory file you've adjusted and ensure that the file /tmp/file.txt
is created on App Server 1
.