home · contact · privacy
Ansible script – improve X config.
[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   # Configure console.
26   - name: symlink console config files
27     file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
28     with_fileglob: ~/config/ansible/files/console/*
29   - name: ensure locales and console-setup are installed
30     apt: name={{item}} state=present
31     with_items:
32     - locales
33     - console-setup
34   - name: generate en_US.UTF-8 locale
35     locale_gen: name=en_US.UTF-8 state=present
36   - name: run setupcon to apply console settings from /etc/default/
37     command: setupcon
38
39   # Miscellaneous.
40   - name: Ensure dotfile symlinks
41     file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
42     with_fileglob:
43     - ~/config/dotfiles/minimal/*
44     - ~/config/dotfiles/root/*
45   - name: ensure ~/.vimbackups directory
46     file: state=directory dest=~/.vimbackups
47   - name: ensure man-db, manpages is installed
48     apt: name={{item}} state=present
49     with_items:
50     - man-db
51     - manpages
52   - name: set /etc/localtime
53     file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
54   - name: ensure sudo, git, vim, less, openssh are installed
55     apt: name={{item}} state=present
56     with_items:
57     - git
58     - vim
59     - less
60     - sudo
61     - openssh-client
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_items:
77     - xserver-xorg-core
78     - xserver-xorg-input-evdev  # supports all input devices the kernel knows about
79     - xinit  # contains startx
80     - libpam-systemd  # needed to start X as non-root
81   - name: ensure basic X tools
82     apt: name={{item}} state=present
83     with_items:
84     - libgl1-mesa-dri  # necessary for OpenGL 3D acceleration to work
85     - xterm
86     - x11-xserver-utils  # includes xrdb which applies .Xresources files
87     - redshift 
88     - i3
89     - i3status
90     - dmenu
91
92   # Set up pentadactyl.
93   - name: ensure browser environment
94     apt: name={{item}} state=present
95     with_items:
96     - iceweasel
97     - xul-ext-noscript
98     - xul-ext-pentadactyl
99     - vim-gtk  # used by pentadactyl for text editing