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