become: yes
tasks:
- # Set hostname.
- - name: symlink hostname file
- file: state=link force=yes src=/root/config/ansible/files/_etc_hostname dest=/etc/hostname
- - name: symlink hosts file
- file: state=link force=yes src=/root/config/ansible/files/_etc_hosts dest=/etc/hosts
+ - name: symlink system files
+ file: state=link force=yes src={{item}} dest={{item|basename|regex_replace('___','/')}}
+ with_fileglob: ~/config/ansible/files/*
- name: set hostname for current session
shell: hostname w530
# Configure package management.
- - name: symlink APT sources file
- file: state=link force=yes src=/root/config/ansible/files/_etc_apt_sources.list dest=/etc/apt/sources.list
- name: update package lists
apt: update_cache=yes
- - name: symlink APT config file
- file: state=link force=yes src=/root/config/ansible/files/_etc_apt_apt.conf.d_99mindeps dest=/etc/apt/apt.conf.d/99mindeps
- name: check for initial_purge_happened flag
stat: path=flags/initial_purge_happened
register: initial_purge
apt: upgrade=dist
# Configure console.
- - name: symlink terminal config file
- file: state=link force=yes src=/root/config/ansible/files/_etc_default_console-setup dest=/etc/default/console-setup
- - name: symlink keyboard config file
- file: state=link force=yes src=/root/config/ansible/files/_etc_default_keyboard dest=/etc/default/keyboard
- - name: ensure locales is installed
- apt: name=locales state=present
- - name: ensure setupcon is installed
- apt: name=console-setup state=present
+ - name: ensure locales and console-setup are installed
+ apt: name={{item}} state=present
+ with_items:
+ - locales
+ - console-setup
- name: generate en_US.UTF-8 locale
locale_gen: name=en_US.UTF-8 state=present
- - name: symlink /etc/profile (with locale export)
- file: state=link force=yes src=/root/config/ansible/files/_etc_profile dest=/etc/profile
- name: run setupcon to apply console settings from /etc/default/
command: setupcon
- - name: ensure boot messages are not cleared on start up
- replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVDisallocate=no'
- # Configure timezone.
- - name: symlink timezone file
- file: state=link force=yes src=/root/config/ansible/files/_etc_timezone dest=/etc/timezone
+ # Miscellaneous.
+ - name: Ensure dotfile symlinks
+ file: state=link force=yes src={{item}} dest=~/.{{item|basename}}
+ with_fileglob: ~/config/ansible/dotfiles/*
+ - name: ensure man-db, manpages is installed
+ apt: name={{item}} state=present
+ with_items:
+ - man-db
+ - manpages
- name: set /etc/localtime
file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
-
- # Set up editor
- - name: set ~/.vimrc
- file: state=link force=yes src=/root/config/ansible/dotfiles/vimrc dest=~/.vimrc
- - name: set ~/.vimrc_add
- file: state=link force=yes src=/root/config/ansible/dotfiles/vimrc_add dest=~/.vimrc_add
- - name: ensure ~/.vimbackups directory
- file: path=~/.vimbackups state=directory
- - name: ensure vim is installed
- apt: name=vim state=present
-
- # Configure shell.
- - name: set ~/.bashrc
- file: state=link force=yes src=/root/config/ansible/dotfiles/bashrc dest=~/.bashrc
- - name: set ~/.profile
- file: state=link force=yes src=/root/config/ansible/dotfiles/profile dest=~/.profile
- - name: set ~/.shinit
- file: state=link force=yes src=/root/config/ansible/dotfiles/shinit dest=~/.shinit
- - name: set ~/.shinit_color
- file: state=link force=yes src=/root/config/ansible/dotfiles/shinit_color dest=~/.shinit_color
-
- # Set up git.
- - name: set ~/.gitconfig
- file: state=link force=yes src=/root/config/ansible/dotfiles/gitconfig dest=~/.gitconfig
- - name: ensure git is installed
- apt: name=git state=present
+ - name: ensure git, vim, less are installed
+ apt: name={{item}} state=present
+ with_items:
+ - git
+ - vim
+ - less
+ - name: create user plom
+ user: name=plom
+ - name: ensure boot messages are not cleared on start up
+ replace: dest=/etc/systemd/system/getty.target.wants/getty@tty1.service regexp='^TTYVTDisallocate=yes.*$' replace='TTYVDisallocate=no'
--- /dev/null
+# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
+# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
+
+if [ "`id -u`" -eq 0 ]; then
+ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+else
+ PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
+fi
+export PATH
+
+if [ "${PS1-}" ]; then
+ if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
+ # The file bash.bashrc already sets the default PS1.
+ # PS1='\h:\w\$ '
+ if [ -f /etc/bash.bashrc ]; then
+ . /etc/bash.bashrc
+ fi
+ else
+ if [ "`id -u`" -eq 0 ]; then
+ PS1='# '
+ else
+ PS1='$ '
+ fi
+ fi
+fi
+
+if [ -d /etc/profile.d ]; then
+ for i in /etc/profile.d/*.sh; do
+ if [ -r $i ]; then
+ . $i
+ fi
+ done
+ unset i
+fi
+export LC_ALL="en_US.UTF-8"
+++ /dev/null
-# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
-# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
-
-if [ "`id -u`" -eq 0 ]; then
- PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-else
- PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
-fi
-export PATH
-
-if [ "${PS1-}" ]; then
- if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
- # The file bash.bashrc already sets the default PS1.
- # PS1='\h:\w\$ '
- if [ -f /etc/bash.bashrc ]; then
- . /etc/bash.bashrc
- fi
- else
- if [ "`id -u`" -eq 0 ]; then
- PS1='# '
- else
- PS1='$ '
- fi
- fi
-fi
-
-if [ -d /etc/profile.d ]; then
- for i in /etc/profile.d/*.sh; do
- if [ -r $i ]; then
- . $i
- fi
- done
- unset i
-fi
-export LC_ALL="en_US.UTF-8"
+++ /dev/null
-# This file is part of systemd.
-#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-
-[Unit]
-Description=Getty on %I
-Documentation=man:agetty(8) man:systemd-getty-generator(8)
-Documentation=http://0pointer.de/blog/projects/serial-console.html
-After=systemd-user-sessions.service plymouth-quit-wait.service
-After=rc-local.service
-
-# If additional gettys are spawned during boot then we should make
-# sure that this is synchronized before getty.target, even though
-# getty.target didn't actually pull it in.
-Before=getty.target
-IgnoreOnIsolate=yes
-
-# IgnoreOnIsolate causes issues with sulogin, if someone isolates
-# rescue.target or starts rescue.service from multi-user.target or
-# graphical.target.
-Conflicts=rescue.service
-Before=rescue.service
-
-# On systems without virtual consoles, don't start any getty. Note
-# that serial gettys are covered by serial-getty@.service, not this
-# unit.
-ConditionPathExists=/dev/tty0
-
-[Service]
-# the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I $TERM
-Type=idle
-Restart=always
-RestartSec=0
-UtmpIdentifier=%I
-TTYPath=/dev/%I
-TTYReset=yes
-TTYVHangup=yes
-TTYVDisallocate=no
-KillMode=process
-IgnoreSIGPIPE=no
-SendSIGHUP=yes
-
-# Unset locale for the console getty since the console has problems
-# displaying some internationalized messages.
-Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
-
-[Install]
-WantedBy=getty.target
-DefaultInstance=tty1