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