#!/usr/bin/env ansible-playbook --- - name: Update hosts: all gather_facts: true tasks: - name: Update all packages with apt apt: name: "*" state: latest register: apt when: ansible_os_family == "Debian" - debug: msg={{ apt.stdout.split('\n')[:-1] }} when: ansible_os_family == "Debian" - name: Update all packages with pacamn pacman: update_cache: yes upgrade: yes register: pacman when: ansible_os_family == "Archlinux" - debug: msg={{ pacman.msg }} when: ansible_os_family == "Archlinux"