home · contact · privacy
d157a2aa0071733cab6245eeb8b02ef76e715fe7
[config] / ansible / config.yml
1 ---
2 - hosts: all
3   user: root
4   become: yes
5   tasks:
6
7   # Set hostname.
8   - name: symlink hostname file 
9     file: state=link force=yes src=/root/config/ansible/files/_etc_hostname dest=/etc/hostname   
10   - name: symlink hosts file 
11     file: state=link force=yes src=/root/config/ansible/files/_etc_hosts dest=/etc/hosts
12   - name: set hostname for current session
13     shell: hostname w530
14
15   # Configure package management.
16   - name: symlink APT sources file
17     file: state=link force=yes src=/root/config/ansible/files/_etc_apt_sources.list dest=/etc/apt/sources.list
18   - name: update package lists
19     apt: update_cache=yes
20   - name: symlink APT config file
21     file: state=link force=yes src=/root/config/ansible/files/_etc_apt_apt.conf.d_99mindeps dest=/etc/apt/apt.conf.d/99mindeps
22   - name: check for initial_purge_happened flag
23     stat: path=flags/initial_purge_happened
24     register: initial_purge
25   - name: perform initial purge
26     include: tasks/initial_purge.yml
27     when: initial_purge.stat.exists == False
28   - name: APT - dist-upgrade
29     apt: upgrade=dist
30
31   # Configure console.
32   - name: symlink terminal config file
33     file: state=link force=yes src=/root/config/ansible/files/_etc_default_console-setup dest=/etc/default/console-setup
34   - name: symlink keyboard config file
35     file: state=link force=yes src=/root/config/ansible/files/_etc_default_keyboard dest=/etc/default/keyboard
36   - name: ensure locales is installed
37     apt: name=locales state=present
38   - name: ensure setupcon is installed
39     apt: name=console-setup state=present
40   - name: generate en_US.UTF-8 locale
41     locale_gen: name=en_US.UTF-8 state=present
42   - name: symlink /etc/profile (with locale export) 
43     file: state=link force=yes src=/root/config/ansible/files/_etc_profile dest=/etc/profile
44   - name: run setupcon to apply console settings from /etc/default/
45     command: setupcon
46   - name: ensure boot messages are not cleared on start up
47     replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVDisallocate=no'
48
49   # Configure timezone.
50   - name: symlink timezone file
51     file: state=link force=yes src=/root/config/ansible/files/_etc_timezone dest=/etc/timezone
52   - name: set /etc/localtime
53     file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
54
55   # Set up editor
56   - name: set ~/.vimrc
57     file: state=link force=yes src=/root/config/ansible/dotfiles/vimrc dest=~/.vimrc
58   - name: set ~/.vimrc_add
59     file: state=link force=yes src=/root/config/ansible/dotfiles/vimrc_add dest=~/.vimrc_add
60   - name: ensure ~/.vimbackups directory
61     file: path=~/.vimbackups state=directory
62   - name: ensure vim is installed
63     apt: name=vim state=present
64
65   # Configure shell.
66   - name: set ~/.bashrc
67     file: state=link force=yes src=/root/config/ansible/dotfiles/bashrc dest=~/.bashrc
68   - name: set ~/.profile
69     file: state=link force=yes src=/root/config/ansible/dotfiles/profile dest=~/.profile
70   - name: set ~/.shinit
71     file: state=link force=yes src=/root/config/ansible/dotfiles/shinit dest=~/.shinit
72   - name: set ~/.shinit_color
73     file: state=link force=yes src=/root/config/ansible/dotfiles/shinit_color dest=~/.shinit_color
74
75   # Set up git.
76   - name: set ~/.gitconfig
77     file: state=link force=yes src=/root/config/ansible/dotfiles/gitconfig dest=~/.gitconfig
78   - name: ensure git is installed
79     apt: name=git state=present