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: check for initial_purge_happened flag
17 # stat: path=flags/initial_purge_happened
18 # register: initial_purge
19 #- name: perform initial purge
20 # include: tasks/initial_purge.yml
21 # when: initial_purge.stat.exists == False
22 - name: APT - dist-upgrade
26 - name: ensure newest kernel and grub are installed
27 apt: name={{item}} state=present
28 with_lines: cat ~/config/ansible/files/apt-mark/newest_kernel | sed -e 's/ *#.*$//'
35 # Ensure power management.
36 - name: ensure power management tools are installed
37 apt: name={{item}} state=present
38 with_lines: cat ~/config/ansible/files/apt-mark/power_management | sed -e 's/ *#.*$//'
46 - name: symlink console config files
47 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
48 with_fileglob: ~/config/ansible/files/console/*
49 - name: ensure locales and console-setup are installed
50 apt: name={{item}} state=present
51 with_lines: cat ~/config/ansible/files/apt-mark/console | sed -e 's/ *#.*$//'
55 - name: generate en_US.UTF-8 locale
56 locale_gen: name=en_US.UTF-8 state=present
57 - name: run setupcon to apply console settings from /etc/default/
61 - name: Ensure dotfile symlinks
62 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
64 - ~/config/dotfiles/minimal/*
65 - ~/config/dotfiles/root/*
66 - name: ensure ~/.vimbackups directory
67 file: state=directory dest=~/.vimbackups
68 - name: ensure man-db, manpages is installed
69 apt: name={{item}} state=present
70 with_lines: cat ~/config/ansible/files/apt-mark/man | sed -e 's/ *#.*$//'
74 - name: set /etc/localtime
75 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
76 - name: ensure sudo, git, vim, less, openssh are installed
77 apt: name={{item}} state=present
78 with_lines: cat ~/config/ansible/files/apt-mark/sudo_git_vim_less_openssh | sed -e 's/ *#.*$//'
85 - name: ensure boot messages are not cleared on start up
86 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
89 - name: create user plom with sudo privileges and bash shell
90 user: name=plom groups=sudo shell=/bin/bash
91 - name: have config repo in user directory
92 git: repo=https://github.com/plomlompom/config dest=/home/plom/config
96 # Ensure X window environment.
97 - name: ensure minimal X window environment
98 apt: name={{item}} state=present
99 with_lines: cat ~/config/ansible/files/apt-mark/minimal_x | sed -e 's/ *#.*$//'
102 #- xserver-xorg-input-evdev # supports all input devices the kernel knows about
103 #- xinit # contains startx
104 #- libpam-systemd # needed to start X as non-root
105 - name: ensure 3d acceleration and optimus switch
106 apt: name={{item}} state=present
107 with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
109 #- linux-headers-amd64 # necessary to build proper nvidia-driver module
110 #- libgl1-mesa-dri # necessary for OpenGL 3D acceleration to work
111 #- libglu1-mesa # necessary for OpenGL 3D acceleration to work
114 - name: ensure basic X tools
115 apt: name={{item}} state=present
116 with_lines: cat ~/config/ansible/files/apt-mark/basic_x_tools | sed -e 's/ *#.*$//'
119 #- x11-xserver-utils # includes xrdb which applies .Xresources files
125 # Set up pentadactyl.
126 - name: ensure browser environment
127 apt: name={{item}} state=present
128 with_lines: cat ~/config/ansible/files/apt-mark/browser_environment | sed -e 's/ *#.*$//'
132 #- xul-ext-pentadactyl
133 #- vim-gtk # used by pentadactyl for text editing
135 # Remove undesired packages
136 # - name: register number of installed packages
137 # shell: dpkg-query -Wf 'x' | wc -c
138 # register: package_count
141 - name: collect desired packages
142 shell: cat files/apt-mark/* | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
143 - name: collect currently installed packages
144 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
145 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
146 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
147 - name: mark all packages from black list as automatically installed
148 shell: apt-mark auto $(cat /tmp/list_black)
149 - name: mark all packages from white list as manually installed
150 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
151 - name: purge all packages automatically installed that are not depended on
152 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove