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
20 #- name: ensure newest kernel and grub are installed
21 # apt: name={{item}} state=present
28 # Ensure power management.
29 - name: ensure power management tools are installed
30 apt: name={{item}} state=present
31 with_lines: cat ~/config/ansible/files/apt-mark/power_management | sed -e 's/ *#.*$//'
39 - name: symlink console config files
40 file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
41 with_fileglob: ~/config/ansible/files/console/*
42 - name: ensure locales and console-setup are installed
43 apt: name={{item}} state=present
44 with_lines: cat ~/config/ansible/files/apt-mark/console | sed -e 's/ *#.*$//'
48 - name: generate en_US.UTF-8 locale
49 locale_gen: name=en_US.UTF-8 state=present
50 - name: run setupcon to apply console settings from /etc/default/
54 - name: Ensure dotfile symlinks
55 file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
57 - ~/config/dotfiles/minimal/*
58 - ~/config/dotfiles/root/*
59 - name: ensure ~/.vimbackups directory
60 file: state=directory dest=~/.vimbackups
61 - name: ensure man-db, manpages is installed
62 apt: name={{item}} state=present
63 with_lines: cat ~/config/ansible/files/apt-mark/man | sed -e 's/ *#.*$//'
64 - name: set /etc/localtime
65 file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
66 - name: ensure sudo, git, vim, less, openssh are installed
67 apt: name={{item}} state=present
68 with_lines: cat ~/config/ansible/files/apt-mark/sudo_git_vim_less_openssh | sed -e 's/ *#.*$//'
69 - name: ensure boot messages are not cleared on start up
70 replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
73 - name: create user plom with sudo privileges and bash shell
74 user: name=plom groups=sudo shell=/bin/bash
75 - name: have config repo in user directory
76 git: repo=https://github.com/plomlompom/config dest=/home/plom/config
80 # Ensure X window environment.
81 - name: ensure minimal X window environment
82 apt: name={{item}} state=present
83 with_lines: cat ~/config/ansible/files/apt-mark/minimal_x | sed -e 's/ *#.*$//'
84 - name: ensure 3d acceleration and optimus switch
85 apt: name={{item}} state=present
86 with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
87 - name: ensure basic X tools
88 apt: name={{item}} state=present
89 with_lines: cat ~/config/ansible/files/apt-mark/basic_x_tools | sed -e 's/ *#.*$//'
92 - name: ensure browser environment
93 apt: name={{item}} state=present
94 with_lines: cat ~/config/ansible/files/apt-mark/browser_environment | sed -e 's/ *#.*$//'
96 # Remove undesired packages
97 # - name: register number of installed packages
98 # shell: dpkg-query -Wf 'x' | wc -c
99 # register: package_count
102 - name: collect desired packages
103 shell: cat files/apt-mark/* | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
104 - name: collect currently installed packages
105 shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
106 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
107 shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
108 - name: mark all packages from black list as automatically installed
109 shell: apt-mark auto $(cat /tmp/list_black)
110 - name: mark all packages from white list as manually installed
111 shell: apt-mark manual $(cat /tmp/white_list_unsorted)
112 - name: purge all packages automatically installed that are not depended on
113 shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove