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_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/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: run setupcon to apply console settings from /etc/default/
45 - name: Ensure dotfile symlinks
46 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
48 - ~/config/dotfiles/minimal/*
49 - ~/config/dotfiles/root/*
50 - name: ensure ~/.vimbackups directory
51 file: state=directory dest=~/.vimbackups
52 - name: ensure man-db, manpages are installed
53 apt: name={{item}} state=present
54 with_lines: cat ~/config/ansible/files/apt-mark/minimal/man | sed -e 's/ *#.*$//'
55 - name: set /etc/localtime
56 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
57 - name: ensure various useful tools are installed – sudo, git, vim, less, openssh
58 apt: name={{item}} state=present
59 with_lines: cat ~/config/ansible/files/apt-mark/minimal/various_useful | sed -e 's/ *#.*$//'
60 - name: ensure boot messages are not cleared on start up
61 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
64 - name: create user plom with sudo privileges and bash shell
65 user: name=plom groups=sudo shell=/bin/bash
66 - name: have config repo in user directory
67 git: repo=https://github.com/plomlompom/config dest=/home/plom/config
71 # Ensure X window environment.
72 - name: ensure minimal X window environment
73 apt: name={{item}} state=present
74 with_lines: cat ~/config/ansible/files/apt-mark/{{ system_name }}/minimal_x | sed -e 's/ *#.*$//'
75 #- name: ensure 3d acceleration and optimus switch
76 # apt: name={{item}} state=present
77 # with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
78 - name: ensure user plom is in bumblebee group
79 user: name=plom groups=bumblebee append=yes
80 - name: ensure basic X tools
81 apt: name={{item}} state=present
82 with_lines: cat ~/config/ansible/files/apt-mark/minimal/basic_x_tools | sed -e 's/ *#.*$//'
85 - name: ensure browser environment
86 apt: name={{item}} state=present
87 with_lines: cat ~/config/ansible/files/apt-mark/minimal/browser_environment | sed -e 's/ *#.*$//'
90 #- name: ensure wifi configuration
91 # apt: name={{item}} state=present
92 # with_lines: cat ~/config/ansible/files/apt-mark/wifi | sed -e 's/ *#.*$//'
94 # Ensure audio/video consumption necessities.
95 #- name: ensure multimedia tools
96 # apt: name={{item}} state=present
97 # with_lines: cat ~/config/ansible/files/apt-mark/multimedia | sed -e 's/ *#.*$//'
101 # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
102 #- name: ensure hotkeys
103 # apt: name={{item}} state=present
104 # with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
106 # Remove undesired packages
107 - name: collect desired packages
108 shell: cat files/apt-mark/minimal/* files/apt-mark/{{ system_name }}/* | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
109 - name: collect currently installed packages
110 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
111 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
112 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
113 - name: mark all packages from black list as automatically installed
114 shell: apt-mark auto $(cat /tmp/list_black)
115 - name: mark all packages from white list as manually installed
116 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
117 - name: purge all packages automatically installed that are not depended on
118 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove