Files
startusingansible/examples/004_services/playbooks/hostname.yml
2026-05-12 17:11:22 +02:00

15 lines
396 B
YAML

---
- hosts: all
gather_facts: true
tasks:
- name: mostrar tots el gather facts
debug:
var: ansible_facts
- name: get server hostname
command: hostname
- name: mostrar IP del host
debug:
msg: "IP: {{ ansible_default_ipv4.address }}"
- name: mostrar hostname
debug:
msg: "Host: {{ ansible_hostname }}"