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 and optimus switch
78 # apt: name={{item}} state=present
79 # with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
80 #- name: ensure user plom is in bumblebee group
81 # user: name=plom groups=bumblebee append=yes
82 - name: ensure basic X tools
83 apt: name={{item}} state=present
84 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/basic_x_tools | sed -e 's/ *#.*$//'
87 - name: ensure browser environment
88 apt: name={{item}} state=present
89 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/browser_environment | sed -e 's/ *#.*$//'
92 - name: ensure wifi configuration
93 apt: name={{item}} state=present
94 with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/wifi | sed -e 's/ *#.*$//'
96 # apt: name={{item}} state=present
97 # with_lines: cat ~/config/ansible/files/apt-mark_new/W530/wicd | sed -e 's/ *#.*$//'
99 # Ensure audio/video consumption necessities.
100 #- name: ensure multimedia tools
101 # apt: name={{item}} state=present
102 # with_lines: cat ~/config/ansible/files/apt-mark/multimedia | sed -e 's/ *#.*$//'
106 # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
107 #- name: ensure hotkeys
108 # apt: name={{item}} state=present
109 # with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
111 # Remove undesired packages
112 - name: collect desired packages
113 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
114 - name: collect currently installed packages
115 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
116 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
117 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
118 - name: mark all packages from black list as automatically installed
119 shell: apt-mark auto $(cat /tmp/list_black)
120 - name: mark all packages from white list as manually installed
121 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
122 - name: purge all packages automatically installed that are not depended on
123 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove