--- - hosts: all gather_facts: yes become: false tasks: - name: Distribution major version debug: msg: "{{ ansible_distribution_major_version }}" # - name: Upgrade # block: # # - name: Update apt repo and cache on all Debian/Ubuntu boxes # apt: # update_cache: yes # force_apt_get: yes # cache_valid_time: 0 # # - name: Prepare. Autoremove old packages # apt: # autoremove: true # autoclean: true # # - name: Update sources # shell: # cmd: | # sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list # # - name: Update apt repo and cache on all Debian/Ubuntu boxes # apt: # update_cache: yes # force_apt_get: yes # cache_valid_time: 0 # # - name: Upgrade all packages on servers # apt: # upgrade: dist # force_apt_get: yes # # - name: Prepare. Autoremove old packages # apt: # autoremove: true # autoclean: true # # when: ansible_distribution_major_version == "11"