From: Christian Heller Date: Sat, 18 Mar 2017 04:05:38 +0000 (+0100) Subject: Shorten ansible attempt. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/static/edit?a=commitdiff_plain;h=278ed64dff6cd5fb8835a5ba022f014506d2e16d;p=config Shorten ansible attempt. --- diff --git a/ansible/config.yml b/ansible/config.yml index d157a2a..3afcbf7 100644 --- a/ansible/config.yml +++ b/ansible/config.yml @@ -4,21 +4,15 @@ 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 @@ -29,51 +23,34 @@ 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' diff --git a/ansible/files/___etc___apt___apt.conf.d___99mindeps b/ansible/files/___etc___apt___apt.conf.d___99mindeps new file mode 100644 index 0000000..4aaef79 --- /dev/null +++ b/ansible/files/___etc___apt___apt.conf.d___99mindeps @@ -0,0 +1,4 @@ +APT::AutoRemove::RecommendsImportant "false"; +APT::AutoRemove::SuggestsImportant "false"; +APT::Install-Recommends "false"; +APT::Install-Suggests "false"; diff --git a/ansible/files/___etc___apt___sources.list b/ansible/files/___etc___apt___sources.list new file mode 100644 index 0000000..e64d6ee --- /dev/null +++ b/ansible/files/___etc___apt___sources.list @@ -0,0 +1,4 @@ +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 diff --git a/ansible/files/___etc___default___console-setup b/ansible/files/___etc___default___console-setup new file mode 100644 index 0000000..090d241 --- /dev/null +++ b/ansible/files/___etc___default___console-setup @@ -0,0 +1,4 @@ +CHARMAP="UTF-8" +CODESET="Lat15" +FONTFACE="Terminus" +FONTSIZE="6x12" diff --git a/ansible/files/___etc___default___keyboard b/ansible/files/___etc___default___keyboard new file mode 100644 index 0000000..b8f918b --- /dev/null +++ b/ansible/files/___etc___default___keyboard @@ -0,0 +1 @@ +XKBLAYOUT="de" diff --git a/ansible/files/___etc___hostname b/ansible/files/___etc___hostname new file mode 100644 index 0000000..8769fca --- /dev/null +++ b/ansible/files/___etc___hostname @@ -0,0 +1 @@ +w530 diff --git a/ansible/files/___etc___hosts b/ansible/files/___etc___hosts new file mode 100644 index 0000000..d920e4f --- /dev/null +++ b/ansible/files/___etc___hosts @@ -0,0 +1,7 @@ +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 diff --git a/ansible/files/___etc___profile b/ansible/files/___etc___profile new file mode 100644 index 0000000..5884d7b --- /dev/null +++ b/ansible/files/___etc___profile @@ -0,0 +1,35 @@ +# /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" diff --git a/ansible/files/___etc___timezone b/ansible/files/___etc___timezone new file mode 100644 index 0000000..94d5acc --- /dev/null +++ b/ansible/files/___etc___timezone @@ -0,0 +1 @@ +Europe/Berlin diff --git a/ansible/files/_etc_apt_apt.conf.d_99mindeps b/ansible/files/_etc_apt_apt.conf.d_99mindeps deleted file mode 100644 index 4aaef79..0000000 --- a/ansible/files/_etc_apt_apt.conf.d_99mindeps +++ /dev/null @@ -1,4 +0,0 @@ -APT::AutoRemove::RecommendsImportant "false"; -APT::AutoRemove::SuggestsImportant "false"; -APT::Install-Recommends "false"; -APT::Install-Suggests "false"; diff --git a/ansible/files/_etc_apt_sources.list b/ansible/files/_etc_apt_sources.list deleted file mode 100644 index e64d6ee..0000000 --- a/ansible/files/_etc_apt_sources.list +++ /dev/null @@ -1,4 +0,0 @@ -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 diff --git a/ansible/files/_etc_default_console-setup b/ansible/files/_etc_default_console-setup deleted file mode 100644 index 090d241..0000000 --- a/ansible/files/_etc_default_console-setup +++ /dev/null @@ -1,4 +0,0 @@ -CHARMAP="UTF-8" -CODESET="Lat15" -FONTFACE="Terminus" -FONTSIZE="6x12" diff --git a/ansible/files/_etc_default_keyboard b/ansible/files/_etc_default_keyboard deleted file mode 100644 index b8f918b..0000000 --- a/ansible/files/_etc_default_keyboard +++ /dev/null @@ -1 +0,0 @@ -XKBLAYOUT="de" diff --git a/ansible/files/_etc_hostname b/ansible/files/_etc_hostname deleted file mode 100644 index 8769fca..0000000 --- a/ansible/files/_etc_hostname +++ /dev/null @@ -1 +0,0 @@ -w530 diff --git a/ansible/files/_etc_hosts b/ansible/files/_etc_hosts deleted file mode 100644 index d920e4f..0000000 --- a/ansible/files/_etc_hosts +++ /dev/null @@ -1,7 +0,0 @@ -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 diff --git a/ansible/files/_etc_profile b/ansible/files/_etc_profile deleted file mode 100644 index 5884d7b..0000000 --- a/ansible/files/_etc_profile +++ /dev/null @@ -1,35 +0,0 @@ -# /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" diff --git a/ansible/files/_etc_systemd_system_getty.target.wants_getty@tty1.service b/ansible/files/_etc_systemd_system_getty.target.wants_getty@tty1.service deleted file mode 100644 index 317d866..0000000 --- a/ansible/files/_etc_systemd_system_getty.target.wants_getty@tty1.service +++ /dev/null @@ -1,53 +0,0 @@ -# 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 diff --git a/ansible/files/_etc_timezone b/ansible/files/_etc_timezone deleted file mode 100644 index 94d5acc..0000000 --- a/ansible/files/_etc_timezone +++ /dev/null @@ -1 +0,0 @@ -Europe/Berlin diff --git a/ansible/run.sh b/ansible/run.sh old mode 100644 new mode 100755