From 278ed64dff6cd5fb8835a5ba022f014506d2e16d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 18 Mar 2017 05:05:38 +0100 Subject: [PATCH] Shorten ansible attempt. --- ansible/config.yml | 77 +++++++------------ ... => ___etc___apt___apt.conf.d___99mindeps} | 0 ...urces.list => ___etc___apt___sources.list} | 0 ...setup => ___etc___default___console-setup} | 0 ...t_keyboard => ___etc___default___keyboard} | 0 .../{_etc_hostname => ___etc___hostname} | 0 ansible/files/{_etc_hosts => ___etc___hosts} | 0 .../files/{_etc_profile => ___etc___profile} | 0 .../{_etc_timezone => ___etc___timezone} | 0 ...stem_getty.target.wants_getty@tty1.service | 53 ------------- ansible/run.sh | 0 11 files changed, 27 insertions(+), 103 deletions(-) rename ansible/files/{_etc_apt_apt.conf.d_99mindeps => ___etc___apt___apt.conf.d___99mindeps} (100%) rename ansible/files/{_etc_apt_sources.list => ___etc___apt___sources.list} (100%) rename ansible/files/{_etc_default_console-setup => ___etc___default___console-setup} (100%) rename ansible/files/{_etc_default_keyboard => ___etc___default___keyboard} (100%) rename ansible/files/{_etc_hostname => ___etc___hostname} (100%) rename ansible/files/{_etc_hosts => ___etc___hosts} (100%) rename ansible/files/{_etc_profile => ___etc___profile} (100%) rename ansible/files/{_etc_timezone => ___etc___timezone} (100%) delete mode 100644 ansible/files/_etc_systemd_system_getty.target.wants_getty@tty1.service mode change 100644 => 100755 ansible/run.sh 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 similarity index 100% rename from ansible/files/_etc_apt_apt.conf.d_99mindeps rename to ansible/files/___etc___apt___apt.conf.d___99mindeps diff --git a/ansible/files/_etc_apt_sources.list b/ansible/files/___etc___apt___sources.list similarity index 100% rename from ansible/files/_etc_apt_sources.list rename to ansible/files/___etc___apt___sources.list diff --git a/ansible/files/_etc_default_console-setup b/ansible/files/___etc___default___console-setup similarity index 100% rename from ansible/files/_etc_default_console-setup rename to ansible/files/___etc___default___console-setup diff --git a/ansible/files/_etc_default_keyboard b/ansible/files/___etc___default___keyboard similarity index 100% rename from ansible/files/_etc_default_keyboard rename to ansible/files/___etc___default___keyboard diff --git a/ansible/files/_etc_hostname b/ansible/files/___etc___hostname similarity index 100% rename from ansible/files/_etc_hostname rename to ansible/files/___etc___hostname diff --git a/ansible/files/_etc_hosts b/ansible/files/___etc___hosts similarity index 100% rename from ansible/files/_etc_hosts rename to ansible/files/___etc___hosts diff --git a/ansible/files/_etc_profile b/ansible/files/___etc___profile similarity index 100% rename from ansible/files/_etc_profile rename to ansible/files/___etc___profile diff --git a/ansible/files/_etc_timezone b/ansible/files/___etc___timezone similarity index 100% rename from ansible/files/_etc_timezone rename to ansible/files/___etc___timezone 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/run.sh b/ansible/run.sh old mode 100644 new mode 100755 -- 2.30.2