7 - name: ensure directories for symlinks exist
8 file: state=directory dest={{item}}
9 with_lines: cat ~/config/ansible/files/dirs | 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/*
13 - name: set hostname for current session
16 # Init package management.
17 - name: update package lists
19 - name: APT - dist-upgrade
22 # Ensure power management.
23 - name: ensure power management tools are installed
24 apt: name={{item}} state=present
25 with_lines: cat ~/config/ansible/files/apt-mark/power_management | sed -e 's/ *#.*$//'
31 # For some reason, some settings are only applied two reboots after this.
32 - name: symlink console config files
33 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
34 with_fileglob: ~/config/ansible/files/console/*
35 - name: ensure locales and console-setup are installed
36 apt: name={{item}} state=present
37 with_lines: cat ~/config/ansible/files/apt-mark/console | sed -e 's/ *#.*$//'
38 - name: generate en_US.UTF-8 locale
39 locale_gen: name=en_US.UTF-8 state=present
40 - name: run setupcon to apply console settings from /etc/default/
44 - name: Ensure dotfile symlinks
45 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
47 - ~/config/dotfiles/minimal/*
48 - ~/config/dotfiles/root/*
49 - name: ensure ~/.vimbackups directory
50 file: state=directory dest=~/.vimbackups
51 - name: ensure man-db, manpages are installed
52 apt: name={{item}} state=present
53 with_lines: cat ~/config/ansible/files/apt-mark/man | sed -e 's/ *#.*$//'
54 - name: set /etc/localtime
55 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
56 - name: ensure various useful tools are installed – sudo, git, vim, less, openssh
57 apt: name={{item}} state=present
58 with_lines: cat ~/config/ansible/files/apt-mark/various_useful | sed -e 's/ *#.*$//'
59 - name: ensure boot messages are not cleared on start up
60 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
63 - name: create user plom with sudo privileges and bash shell
64 user: name=plom groups=sudo shell=/bin/bash
65 - name: have config repo in user directory
66 git: repo=https://github.com/plomlompom/config dest=/home/plom/config
70 # Ensure X window environment.
71 - name: ensure minimal X window environment
72 apt: name={{item}} state=present
73 with_lines: cat ~/config/ansible/files/apt-mark/minimal_x | sed -e 's/ *#.*$//'
74 - name: ensure 3d acceleration and optimus switch
75 apt: name={{item}} state=present
76 with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
77 - name: ensure basic X tools
78 apt: name={{item}} state=present
79 with_lines: cat ~/config/ansible/files/apt-mark/basic_x_tools | sed -e 's/ *#.*$//'
82 - name: ensure browser environment
83 apt: name={{item}} state=present
84 with_lines: cat ~/config/ansible/files/apt-mark/browser_environment | sed -e 's/ *#.*$//'
87 - name: ensure wifi configuration
88 apt: name={{item}} state=present
89 with_lines: cat ~/config/ansible/files/apt-mark/wifi | sed -e 's/ *#.*$//'
91 # Ensure audio/video consumption necessities.
92 - name: ensure multimedia tools
93 apt: name={{item}} state=present
94 with_lines: cat ~/config/ansible/files/apt-mark/multimedia | sed -e 's/ *#.*$//'
98 # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
99 - name: ensure hotkeys
100 apt: name={{item}} state=present
101 with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
103 # Remove undesired packages
104 - name: collect desired packages
105 shell: cat files/apt-mark/* | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
106 - name: collect currently installed packages
107 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
108 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
109 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
110 - name: mark all packages from black list as automatically installed
111 shell: apt-mark auto $(cat /tmp/list_black)
112 - name: mark all packages from white list as manually installed
113 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
114 - name: purge all packages automatically installed that are not depended on
115 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove