home · contact · privacy
Update Firefox version.
[config] / ansible / config_new.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_new | sed -e 's/ *#.*$//'
10   - name: symlink system files
11     file: state=hard force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
12     with_fileglob:
13     - ~/config/ansible/files/system_new/minimal/*
14     - ~/config/ansible/files/system_new/{{ system_name }}/*
15   - name: set hostname for current session
16     shell: hostname {{ system_name }} 
17
18   # Init package management.
19   - name: add palemoon repo signing key
20     apt_key:
21       url: https://download.opensuse.org/repositories/home:stevenpusser/Debian_9.0/Release.key
22       state: present
23   - name: update package lists
24     apt: update_cache=yes
25   - name: APT - dist-upgrade
26     apt: upgrade=dist
27
28   # Ensure packages needed for disk encryption on startup (how does this work?)
29   - name: ensure power management tools are installed
30     apt: name={{item}} state=present
31     with_lines:
32     - cat ~/config/ansible/files/apt-mark_new/minimal/disk_encryption | sed -e 's/ *#.*$//'
33
34   # Ensure power management.
35   - name: ensure power management tools are installed
36     apt: name={{item}} state=present
37     with_lines:
38     - cat ~/config/ansible/files/apt-mark_new/minimal/power_management | sed -e 's/ *#.*$//'
39     - cat ~/config/ansible/files/apt-mark_new/X200s/power_management | sed -e 's/ *#.*$//'
40   - name: start TLP
41     shell: tlp start
42
43   # Configure console.
44   #
45   # For some reason, some settings are only applied two reboots after this.
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_new/minimal/console | sed -e 's/ *#.*$//'
52   - name: generate en_US.UTF-8 locale
53     locale_gen: name=en_US.UTF-8 state=present
54   - name: Touch keyboard config file so setupcon does not ignore it.
55     command: touch /etc/default/keyboard
56   - name: run setupcon to apply console settings from /etc/default/
57     command: setupcon
58
59   # Miscellaneous.
60   - name: Ensure dotfile symlinks
61     file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
62     with_fileglob:
63     - ~/config/dotfiles/minimal/*
64     - ~/config/dotfiles/root/*
65   - name: ensure ~/.vimbackups directory
66     file: state=directory dest=~/.vimbackups
67   - name: ensure man-db, manpages are installed
68     apt: name={{item}} state=present
69     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/man | sed -e 's/ *#.*$//'
70   - name: set /etc/localtime
71     file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
72   - name: ensure various useful tools are installed – sudo, git, vim, less, openssh
73     apt: name={{item}} state=present
74     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/various_useful | sed -e 's/ *#.*$//'
75   - name: ensure boot messages are not cleared on start up
76     replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
77
78   # Config user.
79   - name: create user plom with sudo privileges and bash shell
80     user: name=plom groups=sudo shell=/bin/bash
81   #- name: have config repo in user directory
82   #  git: repo=https://github.com/plomlompom/config dest=/home/plom/config
83   #  become_user: plom
84   #  become_method: su
85
86   # Ensure X window environment.
87   - name: ensure minimal X window environment
88     apt: name={{item}} state=present
89     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/minimal_x | sed -e 's/ *#.*$//'
90   - name: ensure 3d acceleration
91     apt: name={{item}} state=present
92     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/3d_acceleration | sed -e 's/ *#.*$//'
93   #- name: ensure optimus switch
94   #  apt: name={{item}} state=present
95   #  with_lines: cat ~/config/ansible/files/apt-mark_new/W530/3d_acceleration | sed -e 's/ *#.*$//'
96   #- name: ensure user plom is in bumblebee group
97   #  user: name=plom groups=bumblebee append=yes
98   - name: ensure basic X tools
99     apt: name={{item}} state=present
100     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/basic_x_tools | sed -e 's/ *#.*$//'
101
102   ## Set up browser environment.
103   #- name: ensure qutebrowser
104   #  include: tasks/qutebrowser.yml
105   - name: ensure browser environment
106     apt: name={{item}} state=present
107     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/browser_environment | sed -e 's/ *#.*$//'
108
109   # Ensure wifi.
110   - name: ensure wifi configuration
111     apt: name={{item}} state=present
112     with_lines:
113     - cat ~/config/ansible/files/apt-mark_new/minimal/wifi | sed -e 's/ *#.*$//'
114     - cat ~/config/ansible/files/apt-mark_new/X200s/wifi | sed -e 's/ *#.*$//'
115   #- name: ensure wicd
116   #  apt: name={{item}} state=present
117   #  with_lines: cat ~/config/ansible/files/apt-mark_new/W530/wicd | sed -e 's/ *#.*$//'
118
119   # Ensure audio/video consumption necessities.
120   - name: ensure multimedia tools
121     apt: name={{item}} state=present
122     with_lines: cat ~/config/ansible/files/apt-mark_new/minimal/multimedia | sed -e 's/ *#.*$//'
123   #- name: ensure multimedia tools
124   #  apt: name={{item}} state=present
125   #  with_lines: cat ~/config/ansible/files/apt-mark_new/W530/multimedia | sed -e 's/ *#.*$//'
126
127   # Ensure hotkeys.
128   #
129   # For some reason, the brightness hotkeys still won't be available unless acpid is restarted (yes, after reboot).
130   #- name: ensure hotkeys 
131   #  apt: name={{item}} state=present
132   #  with_lines: cat ~/config/ansible/files/apt-mark/hotkeys | sed -e 's/ *#.*$//'
133
134   # Remove undesired packages
135   - name: collect desired packages
136     shell: cat files/apt-mark_new/minimal/* files/apt-mark_new/{{ system_name }}/*  | sed -e 's/ *#.*$//' > /tmp/white_list_unsorted && sort /tmp/white_list_unsorted > /tmp/white_list_sorted
137   - name: collect currently installed packages
138     shell: dpkg-query -Wf '${Package}\n' > /tmp/all_unsorted && sort /tmp/all_unsorted > /tmp/all_sorted
139   - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
140     shell: comm -3 /tmp/all_sorted /tmp/white_list_sorted > /tmp/list_black
141   - name: mark all packages from black list as automatically installed
142     shell: apt-mark auto $(cat /tmp/list_black)
143   - name: mark all packages from white list as manually installed
144     shell: apt-mark manual $(cat /tmp/white_list_unsorted)
145   - name: purge all packages automatically installed that are not depended on
146     shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
147