7 - name: ensure directories for symlinks exist
8 file: state=directory dest={{item}}
9 with_lines: cat ~/config/ansible/files/dirs_new | sed -e 's/ *#.*$//'
10 - name: symlink system files
11 file: state=hard force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
13 - ~/config/ansible/files/system_new/minimal/*
14 - ~/config/ansible/files/system_new/{{ system_name }}/*
15 - name: set hostname for current session
16 shell: hostname {{ system_name }}
18 # Init package management.
19 - name: update package lists
21 - name: APT - dist-upgrade
24 # Ensure power management.
25 - name: ensure power management tools are installed
26 apt: name={{item}} state=present
27 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/power_management | sed -e 's/ *#.*$//'
33 # For some reason, some settings are only applied two reboots after this.
34 - name: symlink console config files
35 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
36 with_fileglob: ~/config/ansible/files/console/*
37 - name: ensure locales and console-setup are installed
38 apt: name={{item}} state=present
39 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/console | sed -e 's/ *#.*$//'
40 - name: generate en_US.UTF-8 locale
41 locale_gen: name=en_US.UTF-8 state=present
42 - name: Touch keyboard config file so setupcon does not ignore it.
43 command: touch /etc/default/keyboard
44 - name: run setupcon to apply console settings from /etc/default/
48 - name: Ensure dotfile symlinks
49 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
51 - ~/config/dotfiles/minimal/*
52 - ~/config/dotfiles/root/*
53 - name: ensure ~/.vimbackups directory
54 file: state=directory dest=~/.vimbackups
55 - name: ensure man-db, manpages are installed
56 apt: name={{item}} state=present
57 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/man | sed -e 's/ *#.*$//'
58 - name: set /etc/localtime
59 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
60 - name: ensure various useful tools are installed – sudo, git, vim, less, openssh
61 apt: name={{item}} state=present
62 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/various_useful | sed -e 's/ *#.*$//'
63 - name: ensure boot messages are not cleared on start up
64 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
67 - name: create user plom with sudo privileges and bash shell
68 user: name=plom groups=sudo shell=/bin/bash
69 #- name: have config repo in user directory
70 # git: repo=https://github.com/plomlompom/config dest=/home/plom/config
74 # Ensure X window environment.
75 - name: ensure minimal X window environment
76 apt: name={{item}} state=present
77 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/minimal_x | sed -e 's/ *#.*$//'
78 - name: ensure 3d acceleration core
79 apt: name={{item}} state=present
80 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/3d_acceleration | sed -e 's/ *#.*$//'
81 #- name: ensure further 3d acceleration and optimus switch
82 # apt: name={{item}} state=present
83 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/3d_acceleration | sed -e 's/ *#.*$//'
84 #- name: ensure user plom is in bumblebee group
85 # user: name=plom groups=bumblebee append=yes
86 - name: ensure basic X tools
87 apt: name={{item}} state=present
88 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/basic_x_tools | sed -e 's/ *#.*$//'
91 - name: ensure qutebrowser
92 include: tasks/qutebrowser.yml
93 - name: ensure browser environment
94 apt: name={{item}} state=present
95 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/browser_environment | sed -e 's/ *#.*$//'
98 - name: ensure wifi configuration
99 apt: name={{item}} state=present
100 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/wifi | sed -e 's/ *#.*$//'
102 # apt: name={{item}} state=present
103 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/wicd | sed -e 's/ *#.*$//'
105 # Ensure audio/video consumption necessities.
106 - name: ensure multimedia tools
107 apt: name={{item}} state=present
108 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/multimedia | sed -e 's/ *#.*$//'
109 #- name: ensure multimedia tools
110 # apt: name={{item}} state=present
111 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/multimedia | sed -e 's/ *#.*$//'
115 # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
116 #- name: ensure hotkeys
117 # apt: name={{item}} state=present
118 # with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
120 # Remove undesired packages
121 - name: collect desired packages
122 shell: cat files/apt-mark_new/minimal/* files/apt-mark_new/{{ system_name }}/* | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
123 - name: collect currently installed packages
124 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
125 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
126 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
127 - name: mark all packages from black list as automatically installed
128 shell: apt-mark auto $(cat /tmp/list_black)
129 - name: mark all packages from white list as manually installed
130 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
131 - name: purge all packages automatically installed that are not depended on
132 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove