Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7436825ae1 | |||
| e7aed210f7 |
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: Test de connexion
|
||||
hosts: all
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Ping all hosts
|
||||
ansible.builtin.ping:
|
||||
|
||||
- name: Afficher le hostname
|
||||
ansible.builtin.command: hostname
|
||||
register: hostname_output
|
||||
|
||||
- name: Montrer le résultat
|
||||
ansible.builtin.debug:
|
||||
msg: "Machine: {{ hostname_output.stdout }}"
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Mise à jour des paquets
|
||||
hosts: all
|
||||
become: yes
|
||||
tasks:
|
||||
- name: Apt update
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Apt upgrade (safe)
|
||||
ansible.builtin.apt:
|
||||
upgrade: safe
|
||||
register: upgrade_result
|
||||
|
||||
- name: Afficher le résultat
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ upgrade_result.stdout_lines | default(['Aucune mise à jour nécessaire']) }}"
|
||||
Reference in New Issue
Block a user