Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
apt_restriced.yml 1.97 KiB
Newer Older
  • Learn to ignore specific revisions
  • - remote_user: "{{ my_user }}"
      become_user: root
      become_method: sudo
    
    Freezed's avatar
    Freezed committed
    
      tasks:
        - name: INCLUDE_VARS | base
          ansible.builtin.include_vars: "main.yml"
    
        - name: INCLUDE_VARS | OS
          ansible.builtin.include_vars: "{{ ansible_distribution }}.yml"
    
        - name: INCLUDE_VARS | Gnome
          when: "'gnome' in group_names"
          ansible.builtin.include_vars: "Gnome.yml"
    
        - name: INCLUDE_VARS | Mate
          when: "'mate' in group_names"
          ansible.builtin.include_vars: "Mate.yml"
    
        - name: APT | install base & os packages
          ansible.builtin.apt:
            cache_valid_time: 3600
            force_apt_get: yes
            pkg: "{{ lookup('flattened', base_pkg, os_pkg) }}"
            state: present
            update_cache: true
    
        - name: APT | install workstation packages
          when: inventory_hostname in groups.station
          ansible.builtin.apt:
            cache_valid_time: 3600
            force_apt_get: yes
            pkg: "{{ lookup('flattened', station_pkg, station_os_pkg, station_wm_pkg) }}"
            state: present
            update_cache: true
    
        - name: APT | uninstall packages
          ansible.builtin.apt:
            pkg: "{{ lookup('flattened', base_uninstall_pkg, os_uninstall_pkg) }}"
            state: absent
    
        - name: APT | upgrade all packages to the latest version
          ansible.builtin.apt:
            force_apt_get: yes
            upgrade: safe
    
        - name: APT | remove useless packages from the cache
          ansible.builtin.apt:
            force_apt_get: yes
            autoclean: yes
            autoremove: yes
    
        - name: APT | check for restarts
          ansible.builtin.stat: path={{ item }}
          register: restart_required
          loop:
          - /var/run/firefox-restart-required
          - /var/run/reboot-required
          no_log: yes
    
        - name: APT | restart message
          ansible.builtin.debug:
            msg: "{{ item.stat.path | basename }} on {{ ansible_hostname }}"
          when: item.stat.exists
          loop: "{{ restart_required.results }}"
          loop_control:
            label: "{{ item.item | basename }}"