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 packages needed for disk encryption on startup (how does this work?)
29 - name: ensure power management tools are installed
30 apt: name={{item}} state=present
32 - cat ~/config/ansible/files/apt-mark_new/minimal/disk_encryption sed -e 's/ *#.*$//'
34 # Ensure power management.
35 - name: ensure power management tools are installed
36 apt: name={{item}} state=present
38 - cat ~/config/ansible/files/apt-mark_new/minimal/power_management | sed -e 's/ *#.*$//'
39 - cat ~/config/ansible/files/apt-mark_new/X200s/power_management | sed -e 's/ *#.*$//'
45 # For some reason, some settings are only applied two reboots after this.
46 - name: symlink console config files
47 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
48 with_fileglob: ~/config/ansible/files/console/*
49 - name: ensure locales and console-setup are installed
50 apt: name={{item}} state=present
51 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/console | sed -e 's/ *#.*$//'
52 - name: generate en_US.UTF-8 locale
53 locale_gen: name=en_US.UTF-8 state=present
54 - name: Touch keyboard config file so setupcon does not ignore it.
55 command: touch /etc/default/keyboard
56 - name: run setupcon to apply console settings from /etc/default/
60 - name: Ensure dotfile symlinks
61 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
63 - ~/config/dotfiles/minimal/*
64 - ~/config/dotfiles/root/*
65 - name: ensure ~/.vimbackups directory
66 file: state=directory dest=~/.vimbackups
67 - name: ensure man-db, manpages are installed
68 apt: name={{item}} state=present
69 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/man | sed -e 's/ *#.*$//'
70 - name: set /etc/localtime
71 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
72 - name: ensure various useful tools are installed – sudo, git, vim, less, openssh
73 apt: name={{item}} state=present
74 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/various_useful | sed -e 's/ *#.*$//'
75 - name: ensure boot messages are not cleared on start up
76 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
79 - name: create user plom with sudo privileges and bash shell
80 user: name=plom groups=sudo shell=/bin/bash
81 #- name: have config repo in user directory
82 # git: repo=https://github.com/plomlompom/config dest=/home/plom/config
86 # Ensure X window environment.
87 - name: ensure minimal X window environment
88 apt: name={{item}} state=present
89 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/minimal_x | sed -e 's/ *#.*$//'
90 - name: ensure 3d acceleration
91 apt: name={{item}} state=present
92 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/3d_acceleration | sed -e 's/ *#.*$//'
93 #- name: ensure optimus switch
94 # apt: name={{item}} state=present
95 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/3d_acceleration | sed -e 's/ *#.*$//'
96 #- name: ensure user plom is in bumblebee group
97 # user: name=plom groups=bumblebee append=yes
98 - name: ensure basic X tools
99 apt: name={{item}} state=present
100 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/basic_x_tools | sed -e 's/ *#.*$//'
102 ## Set up browser environment.
103 #- name: ensure qutebrowser
104 # include: tasks/qutebrowser.yml
105 - name: ensure browser environment
106 apt: name={{item}} state=present
107 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/browser_environment | sed -e 's/ *#.*$//'
110 - name: ensure wifi configuration
111 apt: name={{item}} state=present
113 - cat ~/config/ansible/files/apt-mark_new/minimal/wifi | sed -e 's/ *#.*$//'
114 - cat ~/config/ansible/files/apt-mark_new/X200s/wifi | sed -e 's/ *#.*$//'
116 # apt: name={{item}} state=present
117 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/wicd | sed -e 's/ *#.*$//'
119 # Ensure audio/video consumption necessities.
120 - name: ensure multimedia tools
121 apt: name={{item}} state=present
122 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/multimedia | sed -e 's/ *#.*$//'
123 #- name: ensure multimedia tools
124 # apt: name={{item}} state=present
125 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/multimedia | sed -e 's/ *#.*$//'
129 # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
130 #- name: ensure hotkeys
131 # apt: name={{item}} state=present
132 # with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
134 # Remove undesired packages
135 - name: collect desired packages
136 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
137 - name: collect currently installed packages
138 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
139 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
140 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
141 - name: mark all packages from black list as automatically installed
142 shell: apt-mark auto $(cat /tmp/list_black)
143 - name: mark all packages from white list as manually installed
144 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
145 - name: purge all packages automatically installed that are not depended on
146 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove