First inventory & playbook

This commit is contained in:
Olu
2025-01-25 08:19:20 +00:00
commit 267cbfddb5
2 changed files with 18 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
; first-inventory.ini
[my-localhost]
127.0.0.1 ansible_connection=local
+15
View File
@@ -0,0 +1,15 @@
# first-playbook.yml
---
- name: Basic tasks
# This host is defined in the `first-inventory.ini`
hosts: my-localhost
tasks:
- name: Execute uptime command
command: uptime
register: uptime_result
- debug: var=uptime_result.stdout_lines
- name: Check OS release
command: sw_vers
register: os_result
- debug: var=os_result.stdout_lines