home · contact · privacy
Improve on previous commit.
[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   # Configure package management.
14   - name: update package lists
15     apt: update_cache=yes
16   - name: check for initial_purge_happened flag
17     stat: path=flags/initial_purge_happened
18     register: initial_purge
19   - name: perform initial purge
20     include: tasks/initial_purge.yml
21     when: initial_purge.stat.exists == False
22   - name: APT - dist-upgrade
23     apt: upgrade=dist
24
25   # Upgrade kernel.
26   - name: ensure newest kernel and grub are installed
27     apt: name={{item}} state=present
28     with_items:
29     - linux-image-amd64
30     - grub2
31   - name: update grub
32     shell: update-grub
33
34   # Configure console.
35   - name: symlink console config files
36     file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
37     with_fileglob: ~/config/ansible/files/console/*
38   - name: ensure locales and console-setup are installed
39     apt: name={{item}} state=present
40     with_items:
41     - locales
42     - console-setup
43   - name: generate en_US.UTF-8 locale
44     locale_gen: name=en_US.UTF-8 state=present
45   - name: run setupcon to apply console settings from /etc/default/
46     command: setupcon
47
48   # Miscellaneous.
49   - name: Ensure dotfile symlinks
50     file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
51     with_fileglob:
52     - ~/config/dotfiles/minimal/*
53     - ~/config/dotfiles/root/*
54   - name: ensure ~/.vimbackups directory
55     file: state=directory dest=~/.vimbackups
56   - name: ensure man-db, manpages is installed
57     apt: name={{item}} state=present
58     with_items:
59     - man-db
60     - manpages
61   - name: set /etc/localtime
62     file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
63   - name: ensure sudo, git, vim, less, openssh are installed
64     apt: name={{item}} state=present
65     with_items:
66     - git
67     - vim
68     - less
69     - sudo
70     - openssh-client
71   - name: ensure boot messages are not cleared on start up
72     replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVTDisallocate=no'
73
74   # Config user.
75   - name: create user plom with sudo privileges and bash shell
76     user: name=plom groups=sudo shell=/bin/bash
77   - name: have config repo in user directory
78     git: repo=https://github.com/plomlompom/config dest=/home/plom/config
79     become_user: plom
80     become_method: su
81
82   # Ensure X window environment.
83   - name: ensure minimal X window environment
84     apt: name={{item}} state=present
85     with_items:
86     - xserver-xorg-core
87     - xserver-xorg-input-evdev  # supports all input devices the kernel knows about
88     - xinit  # contains startx
89     - libpam-systemd  # needed to start X as non-root
90   - name: ensure 3d acceleration and optimus switch
91     apt: name={{item}} state=present
92     with_items:
93     - linux-headers-amd64  # necessary to build proper nvidia-driver module
94     - libgl1-mesa-dri  # necessary for OpenGL 3D acceleration to work
95     - libglu1-mesa  # necessary for OpenGL 3D acceleration to work
96     - bumblebee-nvidia
97     - primus
98   - name: ensure basic X tools
99     apt: name={{item}} state=present
100     with_items:
101     - xterm
102     - x11-xserver-utils  # includes xrdb which applies .Xresources files
103     - redshift 
104     - i3
105     - i3status
106     - dmenu
107
108   # Set up pentadactyl.
109   - name: ensure browser environment
110     apt: name={{item}} state=present
111     with_items:
112     - iceweasel
113     - xul-ext-noscript
114     - xul-ext-pentadactyl
115     - vim-gtk  # used by pentadactyl for text editing