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