diff --git a/Makefile b/Makefile index f9580786924cf59084b9755293fdf5b469d243cb..3befe11690a113fa1c1c8fdc807ac089ca730d50 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ clean: open_all: ${EDITOR} .gitignore inventory Makefile README.md + ${EDITOR} tasks/files/* + ${EDITOR} tasks/vars/* ${EDITOR} tasks/*.yml inventory_generation: diff --git a/tasks/apt.yml b/tasks/apt.yml new file mode 100644 index 0000000000000000000000000000000000000000..f456c96e859b9680c70c535aafc6e87e2d3167ea --- /dev/null +++ b/tasks/apt.yml @@ -0,0 +1,82 @@ +--- +- hosts: "{{ host_list }}" + remote_user: root + + 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: Remove snap packages + when: snap_uninstall_pkg is defined + community.general.snap: + name: "{{ snap_uninstall_pkg }}" + state: absent + + - name: APT | Install base packages + ansible.builtin.apt: + cache_valid_time: 3600 + force_apt_get: yes + pkg: "{{ lookup('flattened', base_pkg) }}" + state: present + update_cache: true + + - name: APT | Install OS packages + ansible.builtin.apt: + cache_valid_time: 3600 + force_apt_get: yes + pkg: "{{ lookup('flattened', 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 }}" diff --git a/tasks/become_user_cfg.yml b/tasks/become_user_cfg.yml index ea041dc185774cbb6b28aa27d77fdf0230fe1f75..53801a22e56d0db471fdf9e0af6a11ec0bc3af70 100644 --- a/tasks/become_user_cfg.yml +++ b/tasks/become_user_cfg.yml @@ -36,7 +36,6 @@ state: present user: "{{ my_user }}" - - name: SSH | Disallow SSHÂ password authentication for root become: yes copy: diff --git a/tasks/vars/Debian.yml b/tasks/vars/Debian.yml new file mode 100644 index 0000000000000000000000000000000000000000..109b270a49cae8193b685e32cbcfebdf1e8828cd --- /dev/null +++ b/tasks/vars/Debian.yml @@ -0,0 +1,9 @@ +--- + +os_pkg: [] + +os_uninstall_pkg: [] + +station_os_pkg: + - chromium-l10n + - firefox-esr-l10n-fr diff --git a/tasks/vars/Gnome.yml b/tasks/vars/Gnome.yml new file mode 100644 index 0000000000000000000000000000000000000000..3717a48cc6c55fc9656de2c76f3d7e586f5bd3c2 --- /dev/null +++ b/tasks/vars/Gnome.yml @@ -0,0 +1,5 @@ +--- + +station_wm_pkg: + - gnome-tweaks + - nautilus-nextcloud diff --git a/tasks/vars/Mate.yml b/tasks/vars/Mate.yml new file mode 100644 index 0000000000000000000000000000000000000000..4fb645d86a7bdc8db81e652c2ee44408ff418a59 --- /dev/null +++ b/tasks/vars/Mate.yml @@ -0,0 +1,5 @@ +--- + +station_wm_pkg: + - mate-tweak + - caja-nextcloud diff --git a/tasks/vars/Ubuntu.yml b/tasks/vars/Ubuntu.yml new file mode 100644 index 0000000000000000000000000000000000000000..e2d262c921b4d34fb4cab8a5b92473efd66c597f --- /dev/null +++ b/tasks/vars/Ubuntu.yml @@ -0,0 +1,14 @@ +--- + +os_pkg: [] + +os_uninstall_pkg: + - thunderbird + +snap_uninstall_pkg: + - firefox + +station_os_pkg: + - chromium-browser-l10n + - firefox-locale-fr + - firefox diff --git a/tasks/vars/main.yml b/tasks/vars/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..41ff73f0d95de3b136bea7b5e0c3e174d668d4d5 --- /dev/null +++ b/tasks/vars/main.yml @@ -0,0 +1,59 @@ +--- + +base_pkg: + - htop + - iotop + - locales + - lsb-release + - lsof + - lynx + - most + - progress + - python3-apt + - rsync + - screen + - sudo + - tmux + - unattended-upgrades + - unzip + - vim + - wget + - xkcdpass + +base_uninstall_pkg: [] + +station_pkg: + - ansible + - cheese + - easytag + - evolution + - evolution-plugins + - geany-plugin-addons + - geany-plugin-extrasel + - geany-plugin-git-changebar + - geany-plugin-markdown + - geany-plugin-prettyprinter + - geany-plugin-shiftcolumn + - geany-plugin-spellcheck + - geany-plugin-workbench + - geany-plugin-xmlsnippets + - git + - gnome-disk-utility + - gpsprune + - hplip + - jhead + - keepassx + - make + - meld + - mhwaveedit + - network-manager-gnome + - nextcloud-desktop + - pdftk + - photocollage + - sshpass + - tree + - simple-scan + - soundconverter + - system-config-printer + - torbrowser-launcher + - unrar-free