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: add palemoon repo signing key
21 url: https://download.opensuse.org/repositories/home:stevenpusser/Debian_9.0/Release.key
23 - name: update package lists
25 - name: APT - dist-upgrade
28 # Ensure power management.
29 - name: ensure power management tools are installed
30 apt: name={{item}} state=present
31 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/power_management | sed -e 's/ *#.*$//'
32 with_lines: cat ~/config/ansible/files/apt-mark_new/X200s/power_management | sed -e 's/ *#.*$//'
38 # For some reason, some settings are only applied two reboots after this.
39 - name: symlink console config files
40 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
41 with_fileglob: ~/config/ansible/files/console/*
42 - name: ensure locales and console-setup are installed
43 apt: name={{item}} state=present
44 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/console | sed -e 's/ *#.*$//'
45 - name: generate en_US.UTF-8 locale
46 locale_gen: name=en_US.UTF-8 state=present
47 - name: Touch keyboard config file so setupcon does not ignore it.
48 command: touch /etc/default/keyboard
49 - name: run setupcon to apply console settings from /etc/default/
53 - name: Ensure dotfile symlinks
54 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
56 - ~/config/dotfiles/minimal/*
57 - ~/config/dotfiles/root/*
58 - name: ensure ~/.vimbackups directory
59 file: state=directory dest=~/.vimbackups
60 - name: ensure man-db, manpages are installed
61 apt: name={{item}} state=present
62 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/man | sed -e 's/ *#.*$//'
63 - name: set /etc/localtime
64 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
65 - name: ensure various useful tools are installed – sudo, git, vim, less, openssh
66 apt: name={{item}} state=present
67 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/various_useful | sed -e 's/ *#.*$//'
68 - name: ensure boot messages are not cleared on start up
69 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
72 - name: create user plom with sudo privileges and bash shell
73 user: name=plom groups=sudo shell=/bin/bash
74 #- name: have config repo in user directory
75 # git: repo=https://github.com/plomlompom/config dest=/home/plom/config
79 # Ensure X window environment.
80 - name: ensure minimal X window environment
81 apt: name={{item}} state=present
82 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/minimal_x | sed -e 's/ *#.*$//'
83 - name: ensure 3d acceleration
84 apt: name={{item}} state=present
85 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/3d_acceleration | sed -e 's/ *#.*$//'
86 #- name: ensure optimus switch
87 # apt: name={{item}} state=present
88 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/3d_acceleration | sed -e 's/ *#.*$//'
89 #- name: ensure user plom is in bumblebee group
90 # user: name=plom groups=bumblebee append=yes
91 - name: ensure basic X tools
92 apt: name={{item}} state=present
93 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/basic_x_tools | sed -e 's/ *#.*$//'
95 ## Set up browser environment.
96 #- name: ensure qutebrowser
97 # include: tasks/qutebrowser.yml
98 - name: ensure browser environment
99 apt: name={{item}} state=present
100 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/browser_environment | sed -e 's/ *#.*$//'
103 - name: ensure wifi configuration
104 apt: name={{item}} state=present
105 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/wifi | sed -e 's/ *#.*$//'
106 with_lines: cat ~/config/ansible/files/apt-mark_new/X200s/wifi | sed -e 's/ *#.*$//'
108 # apt: name={{item}} state=present
109 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/wicd | sed -e 's/ *#.*$//'
111 # Ensure audio/video consumption necessities.
112 - name: ensure multimedia tools
113 apt: name={{item}} state=present
114 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/multimedia | sed -e 's/ *#.*$//'
115 #- name: ensure multimedia tools
116 # apt: name={{item}} state=present
117 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/multimedia | sed -e 's/ *#.*$//'
121 # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
122 #- name: ensure hotkeys
123 # apt: name={{item}} state=present
124 # with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
126 # Remove undesired packages
127 - name: collect desired packages
128 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
129 - name: collect currently installed packages
130 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
131 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
132 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
133 - name: mark all packages from black list as automatically installed
134 shell: apt-mark auto $(cat /tmp/list_black)
135 - name: mark all packages from white list as manually installed
136 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
137 - name: purge all packages automatically installed that are not depended on
138 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove