home · contact · privacy
Add eject to multimedia installation.
[config] / ansible / config.yml
1 ---
2 - hosts: all
3   user: root
4   become: yes
5   tasks:
6
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
11     shell: hostname w530
12
13   # Init package management.
14   - name: update package lists
15     apt: update_cache=yes
16   - name: APT - dist-upgrade
17     apt: upgrade=dist
18
19   # Ensure power management.
20   - name: ensure power management tools are installed
21     apt: name={{item}} state=present
22     with_lines: cat ~/config/ansible/files/apt-mark/power_management | sed -e 's/ *#.*$//'
23   - name: start TLP
24     shell: tlp start
25
26   # Configure console.
27   #
28   # For some reason, some settings are only applied two reboots after this.
29   - name: symlink console config files
30     file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
31     with_fileglob: ~/config/ansible/files/console/*
32   - name: ensure locales and console-setup are installed
33     apt: name={{item}} state=present
34     with_lines: cat ~/config/ansible/files/apt-mark/console | sed -e 's/ *#.*$//'
35   - name: generate en_US.UTF-8 locale
36     locale_gen: name=en_US.UTF-8 state=present
37   - name: run setupcon to apply console settings from /etc/default/
38     command: setupcon
39
40   # Miscellaneous.
41   - name: Ensure dotfile symlinks
42     file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
43     with_fileglob:
44     - ~/config/dotfiles/minimal/*
45     - ~/config/dotfiles/root/*
46   - name: ensure ~/.vimbackups directory
47     file: state=directory dest=~/.vimbackups
48   - name: ensure man-db, manpages are installed
49     apt: name={{item}} state=present
50     with_lines: cat ~/config/ansible/files/apt-mark/man | sed -e 's/ *#.*$//'
51   - name: set /etc/localtime
52     file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
53   - name: ensure various useful tools are installed – sudo, git, vim, less, openssh, alsamixer
54     apt: name={{item}} state=present
55     with_lines: cat ~/config/ansible/files/apt-mark/various_useful | sed -e 's/ *#.*$//'
56   - name: ensure boot messages are not cleared on start up
57     replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
58
59   # Config user.
60   - name: create user plom with sudo privileges and bash shell
61     user: name=plom groups=sudo shell=/bin/bash
62   - name: have config repo in user directory
63     git: repo=https://github.com/plomlompom/config dest=/home/plom/config
64     become_user: plom
65     become_method: su
66
67   # Ensure X window environment.
68   - name: ensure minimal X window environment
69     apt: name={{item}} state=present
70     with_lines: cat ~/config/ansible/files/apt-mark/minimal_x | sed -e 's/ *#.*$//'
71   - name: ensure 3d acceleration and optimus switch
72     apt: name={{item}} state=present
73     with_lines: cat ~/config/ansible/files/apt-mark/3d_acceleration | sed -e 's/ *#.*$//'
74   - name: ensure basic X tools
75     apt: name={{item}} state=present
76     with_lines: cat ~/config/ansible/files/apt-mark/basic_x_tools | sed -e 's/ *#.*$//'
77
78   # Set up pentadactyl.
79   - name: ensure browser environment
80     apt: name={{item}} state=present
81     with_lines: cat ~/config/ansible/files/apt-mark/browser_environment | sed -e 's/ *#.*$//'
82
83   # Ensure audio/video consumption necessities.
84   - name: ensure multimedia tools
85     apt: name={{item}} state=present
86     with_lines: cat ~/config/ansible/files/apt-mark/multimedia | sed -e 's/ *#.*$//'
87
88   # Remove undesired packages
89   - name: collect desired packages
90     shell: cat files/apt-mark/*  | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
91   - name: collect currently installed packages
92     shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
93   - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
94     shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
95   - name: mark all packages from black list as automatically installed
96     shell: apt-mark auto $(cat /tmp/list_black)
97   - name: mark all packages from white list as manually installed
98     shell: apt-mark manual $(cat /tmp/white_list_unsorted)
99   - name: purge all packages automatically installed that are not depended on
100     shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove