7 - name: symlink system files
8 file: state=hard force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
9 with_fileglob: ~/config/ansible/files/system/*
10 - name: set hostname for current session
13 # Configure package management.
14 - name: update package lists
16 - name: APT - dist-upgrade
19 # Ensure power management.
20 - name: ensure power management tools are installed
21 apt: name={{item}} state=present
22 with_lines: cat ~/config/ansible/files/apt-mark/power_management | sed -e 's/ *#.*$//'
28 # For some reason, some settings are only applied two reboots after this.
29 - name: symlink console config files
30 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
31 with_fileglob: ~/config/ansible/files/console/*
32 - name: ensure locales and console-setup are installed
33 apt: name={{item}} state=present
34 with_lines: cat ~/config/ansible/files/apt-mark/console | sed -e 's/ *#.*$//'
35 - name: generate en_US.UTF-8 locale
36 locale_gen: name=en_US.UTF-8 state=present
37 - name: run setupcon to apply console settings from /etc/default/
41 - name: Ensure dotfile symlinks
42 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
44 - ~/config/dotfiles/minimal/*
45 - ~/config/dotfiles/root/*
46 - name: ensure ~/.vimbackups directory
47 file: state=directory dest=~/.vimbackups
48 - name: ensure man-db, manpages are installed
49 apt: name={{item}} state=present
50 with_lines: cat ~/config/ansible/files/apt-mark/man | sed -e 's/ *#.*$//'
51 - name: set /etc/localtime
52 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
53 - name: ensure various useful tools are installed: sudo, git, vim, less, openssh, alsamixer
54 apt: name={{item}} state=present
55 with_lines: cat ~/config/ansible/files/apt-mark/various_useful | sed -e 's/ *#.*$//'
56 - name: ensure boot messages are not cleared on start up
57 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
60 - name: create user plom with sudo privileges and bash shell
61 user: name=plom groups=sudo shell=/bin/bash
62 - name: have config repo in user directory
63 git: repo=https://github.com/plomlompom/config dest=/home/plom/config
67 # Ensure X window environment.
68 - name: ensure minimal X window environment
69 apt: name={{item}} state=present
70 with_lines: cat ~/config/ansible/files/apt-mark/minimal_x | sed -e 's/ *#.*$//'
71 - name: ensure 3d acceleration and optimus switch
72 apt: name={{item}} state=present
73 with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
74 - name: ensure basic X tools
75 apt: name={{item}} state=present
76 with_lines: cat ~/config/ansible/files/apt-mark/basic_x_tools | sed -e 's/ *#.*$//'
79 - name: ensure browser environment
80 apt: name={{item}} state=present
81 with_lines: cat ~/config/ansible/files/apt-mark/browser_environment | sed -e 's/ *#.*$//'
83 # Remove undesired packages
84 - name: collect desired packages
85 shell: cat files/apt-mark/* | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
86 - name: collect currently installed packages
87 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
88 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
89 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
90 - name: mark all packages from black list as automatically installed
91 shell: apt-mark auto $(cat /tmp/list_black)
92 - name: mark all packages from white list as manually installed
93 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
94 - name: purge all packages automatically installed that are not depended on
95 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove