become: yes
tasks:
- - include: tasks/hostname.yml
- vars:
- hostname: w530
+ # 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: set hostname for current session
+ shell: hostname w530
- - include: tasks/apt_init.yml
+ # 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
+ - name: perform initial purge
+ include: tasks/initial_purge.yml
+ when: initial_purge.stat.exists == False
+ - name: APT - dist-upgrade
+ apt: upgrade=dist
- - include: tasks/console_init.yml
+ # 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: 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'
- - include: tasks/timezone.yml
- vars:
- timezone: Europe/Berlin
+ # Configure timezone.
+ - name: symlink timezone file
+ file: state=link force=yes src=/root/config/ansible/files/_etc_timezone dest=/etc/timezone
+ - name: set /etc/localtime
+ file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime
- - name: ensure boot messages are not cleand on start up
- replace:
- dest: /etc/systemd/system/getty.target.wants/getty@tty1.service
- regexp: '^TTYVTDisallocate=yes.*$'
- replace: 'TTYVDisallocate=no'
+ # 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
--- /dev/null
+# Bash as a non-login shell in non-POSIX-mode does not read in the startup
+# script at the path in $ENV. This forces it to still read in the ~/.shinit
+# startup script for non-login shells.
+
+. ~/.shinit
--- /dev/null
+[user]
+ name = Christian Heller
+ email = c.heller@plomlompom.de
--- /dev/null
+# Initialization for login shells.
+
+# Tell interactive shells to look in ~/.shinit for setup.
+ENV=$HOME/.shinit
+export ENV
+. $ENV
--- /dev/null
+# Settings for interactive shells.
+
+# Ensure shell truly is interactive to avoid confusing non-interactive shells.
+if [[ $- == *i* ]]; then
+
+ # Fancy colors for ls.
+ alias ls="ls --color=auto"
+
+ # Use vim as default editor for anything.
+ export VISUAL=vim
+ export EDITOR=$VISUAL
+
+ # Colored prompt with username, hostname, date/time, directory.
+ colornumber=7 # Default to white if no color set via colornumber dotfile.
+ colornumber_file=~/.shinit_color
+ if [ -f $colornumber_file ]; then
+ colornumber=`cat $colornumber_file`
+ fi
+ tput_color="$(tput setaf $colornumber)$(tput bold)"
+ tput_reset="$(tput sgr0)"
+ # Bash confuses the line length when not told to not count escape sequences.
+ if [ ! "$BASH" = "" ]; then
+ tput_color="\[$tput_color\]"
+ tput_reset="\[$tput_reset\]"
+ fi
+ PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $USER@$(hostname):"\$\(pwd\)"]$ $tput_reset"
+ PS2="${tput_color}> $tput_reset"
+ PS3="${tput_color}select: $tput_reset"
+ PS4="${tput_color}+ $tput_reset"
+
+ # Add local additions.
+ local_shinit_file=~/.shinit_add
+ if [ -f $local_shinit_file ]; then
+ . $local_shinit_file
+ fi
+
+fi
--- /dev/null
+" Activate syntax highlighting.
+syntax on
+filetype plugin on
+
+" Number lines.
+set number
+
+" Don't add unsolicited final newline.
+set binary
+
+" Indentation rules (tabs to 4 spaces).
+set expandtab
+set shiftwidth=2
+set softtabstop=2
+
+" Backups.
+set backup
+set backupdir=~/.vimbackups
+let myvar = strftime("%Y-%m-%d_%H-%M-%S")
+let myvar = "set backupext=_". myvar
+execute myvar
+
+" Keep syntax highlighting healthy.
+autocmd BufEnter * :syntax sync fromstart
+
+" Mark the 80-th column.
+set colorcolumn=80
+
+" Source additions
+source ~/.vimrc_add
--- /dev/null
+deb http://ftp.debian.org/debian/ stretch main contrib non-free
+deb http://ftp.debian.org/debian/ stretch-updates main contrib non-free
+deb http://ftp.debian.org/debian stretch-backports main contrib non-free
+deb http://security.debian.org/ stretch/updates main contrib non-free
--- /dev/null
+127.0.0.1 localhost
+127.0.1.1 w530
+
+# The following lines are desirable for IPv6 capable hosts
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
--- /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
--- /dev/null
+Europe/Berlin
+++ /dev/null
----
-- include: tasks/set_repos.yml
-
-- name: update package lists
- apt:
- update_cache: yes
-
-- name: write APT config file
- copy:
- src: 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
-
-- name: perform initial purge
- include: tasks/initial_purge.yml
- when: initial_purge.stat.exists == False
-
-- name: APT - dist-upgrade
- apt:
- upgrade: dist
+++ /dev/null
----
-- name: write terminal config file
- copy:
- src: files/_etc_default_console-setup
- dest: /etc/default/console-setup
-
-- name: write keyboard config file
- copy:
- src: 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: generate en_US.UTF-8 locale
- locale_gen:
- name: en_US.UTF-8
- state: present
-
-- name: write /etc/profile (with locale export)
- copy:
- src: files/_etc_profile
- dest: /etc/profile
-
-- name: run setupcon to apply console settings from /etc/default/
- command: setupcon
+++ /dev/null
----
-
-- name: set hostname in /etc/hostname
- shell: echo {{ hostname }} > /etc/hostname
-
-- name: set hostname in /etc/hosts
- replace:
- dest: /etc/hosts
- regexp: '^127\.0\.1\.1.*$'
- replace: '127.0.1.1 {{ hostname }}'
-
-- name: set hostname for current session
- shell: hostname {{ hostname }}
shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
- name: ensure flags directory exists
- file:
- path: flags
- state: directory
+ file: path=flags state=directory
- name: set initial_purge_happened flag, so that this whole process does not get repeated
- file:
- path: flags/initial_purge_happened
- state: touch
+ file: path=flags/initial_purge_happened state=touch
+++ /dev/null
----
-
-- name: APT - use stretch repo
- apt_repository:
- repo: deb http://ftp.debian.org/debian/ stretch main contrib non-free
- state: present
-
-- name: APT - use stretch security updates repo
- apt_repository:
- repo: deb http://security.debian.org/ stretch/updates main contrib non-free
- state: present
-
-- name: APT - use stretch-updates repo
- apt_repository:
- repo: deb http://ftp.debian.org/debian/ stretch-updates main contrib non-free
- state: present
-
-- name: APT - use stretch-backports repo
- apt_repository:
- repo: deb http://ftp.debian.org/debian stretch-backports main contrib non-free
- state: present
+++ /dev/null
----
-
-- name: set /etc/timezone
- shell: echo '{{ timezone }}' > /etc/timezone
-
-- name: set /etc/localtime
- file:
- src: /usr/share/zoneinfo/{{ timezone }}
- path: /etc/localtime
- state: link