summaryrefslogtreecommitdiff
path: root/examples/update_datetime.yaml
diff options
context:
space:
mode:
authorluisgulo <luisgulo@gmail.com>2025-10-24 18:01:10 +0200
committerluisgulo <luisgulo@gmail.com>2025-10-24 18:01:10 +0200
commit533e79ba959143f0459431a486bfb85c56c72ddc (patch)
tree91974de1bbbdc4c51c76ed591fc5c6e02a3342b6 /examples/update_datetime.yaml
parent45019c81cfd0fc1d18dce18cdfd5f127c6d61073 (diff)
Releasing code version 1.8.0
Diffstat (limited to 'examples/update_datetime.yaml')
-rw-r--r--examples/update_datetime.yaml43
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/update_datetime.yaml b/examples/update_datetime.yaml
new file mode 100644
index 0000000..3dde6a1
--- /dev/null
+++ b/examples/update_datetime.yaml
@@ -0,0 +1,43 @@
+parallelism: false
+
+tasks:
+ - name: Verificar disponibilidad de chronyc
+ module: run
+ args:
+ command: "command -v chronyc >/dev/null"
+ capture_err: chrony_err
+
+ - name: Abortar si chronyc no está disponible
+ module: run
+ args:
+ command: "echo '{{ chrony_err }}' | grep -q '1' && echo '❌ Chrony no está instalado. No se puede ajustar la hora.' && exit 1 || true"
+
+ - name: Sincronizar hora con Chrony
+ module: run
+ args:
+ command: "chronyc -a makestep"
+ become: true
+ capture_log: sync_result
+ capture_err: sync_err
+
+ - name: Mostrar valores de sincronizacion
+ module: echo
+ args:
+ message: "Cod.Err: {{ sync_err }} - {{ sync_result }}"
+
+ - name: Validar sincronización
+ module: run
+ args:
+ command: "echo '{{ sync_result }}' | grep -q '200 OK' && echo '✅ Hora sincronizada correctamente' || echo '❌ Fallo en sincronización'"
+
+
+ - name: Verificar estado del reloj
+ module: run
+ args:
+ command: "timedatectl status"
+
+ - name: ls en root
+ module: run
+ args:
+ command: "ls -l /root"
+ become: true