From edfe462345327a4f59ad6559835c5a30f1c92160 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 18 Mar 2017 11:51:11 +0100 Subject: [PATCH] Ansible experiment: add user script. --- ansible/config.yml | 22 ++++++++++++++----- ansible/files/dotfiles/{ => minimal}/bashrc | 0 .../files/dotfiles/{ => minimal}/gitconfig | 0 ansible/files/dotfiles/{ => minimal}/profile | 0 ansible/files/dotfiles/{ => minimal}/shinit | 0 ansible/files/dotfiles/{ => minimal}/vimrc | 0 .../files/dotfiles/{ => root}/shinit_color | 0 ansible/files/dotfiles/{ => root}/vimrc_add | 0 ansible/run_user.sh | 1 + ansible/user.yml | 11 ++++++++++ 10 files changed, 29 insertions(+), 5 deletions(-) rename ansible/files/dotfiles/{ => minimal}/bashrc (100%) rename ansible/files/dotfiles/{ => minimal}/gitconfig (100%) rename ansible/files/dotfiles/{ => minimal}/profile (100%) rename ansible/files/dotfiles/{ => minimal}/shinit (100%) rename ansible/files/dotfiles/{ => minimal}/vimrc (100%) rename ansible/files/dotfiles/{ => root}/shinit_color (100%) rename ansible/files/dotfiles/{ => root}/vimrc_add (100%) create mode 100644 ansible/run_user.sh create mode 100644 ansible/user.yml diff --git a/ansible/config.yml b/ansible/config.yml index b34b529..5ae4a3a 100644 --- a/ansible/config.yml +++ b/ansible/config.yml @@ -37,9 +37,12 @@ command: setupcon # Miscellaneous. - - name: Ensure dotfile symlinks + - name: Ensure minimal dotfile symlinks file: state=link force=yes src={{item}} dest=~/.{{item|basename}} - with_fileglob: ~/config/ansible/files/dotfiles/* + with_fileglob: ~/config/ansible/files/dotfiles/minimal/* + - name: Ensure root user dotfile symlinks + file: state=link force=yes src={{item}} dest=~/.{{item|basename}} + with_fileglob: ~/config/ansible/files/dotfiles/root/* - name: ensure ~/.vimbackups directory file: state=directory dest=~/.vimbackups - name: ensure man-db, manpages is installed @@ -49,13 +52,22 @@ - manpages - name: set /etc/localtime file: state=link force=yes src=/usr/share/zoneinfo/Europe/Berlin dest=/etc/localtime - - name: ensure git, vim, less are installed + - name: ensure sudo, git, vim, less are installed apt: name={{item}} state=present with_items: - git - vim - less - - name: create user plom - user: name=plom + - sudo - 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' + + # Config user. + - name: create user plom + user: name=plom + - name: have config repo in user directory + git: repo=git://github.com/plomlompom/config dest=/home/plom/config + become_user: plom + become_method: su + - name: ensure user has sudo privileges + command: adduser plom sudo diff --git a/ansible/files/dotfiles/bashrc b/ansible/files/dotfiles/minimal/bashrc similarity index 100% rename from ansible/files/dotfiles/bashrc rename to ansible/files/dotfiles/minimal/bashrc diff --git a/ansible/files/dotfiles/gitconfig b/ansible/files/dotfiles/minimal/gitconfig similarity index 100% rename from ansible/files/dotfiles/gitconfig rename to ansible/files/dotfiles/minimal/gitconfig diff --git a/ansible/files/dotfiles/profile b/ansible/files/dotfiles/minimal/profile similarity index 100% rename from ansible/files/dotfiles/profile rename to ansible/files/dotfiles/minimal/profile diff --git a/ansible/files/dotfiles/shinit b/ansible/files/dotfiles/minimal/shinit similarity index 100% rename from ansible/files/dotfiles/shinit rename to ansible/files/dotfiles/minimal/shinit diff --git a/ansible/files/dotfiles/vimrc b/ansible/files/dotfiles/minimal/vimrc similarity index 100% rename from ansible/files/dotfiles/vimrc rename to ansible/files/dotfiles/minimal/vimrc diff --git a/ansible/files/dotfiles/shinit_color b/ansible/files/dotfiles/root/shinit_color similarity index 100% rename from ansible/files/dotfiles/shinit_color rename to ansible/files/dotfiles/root/shinit_color diff --git a/ansible/files/dotfiles/vimrc_add b/ansible/files/dotfiles/root/vimrc_add similarity index 100% rename from ansible/files/dotfiles/vimrc_add rename to ansible/files/dotfiles/root/vimrc_add diff --git a/ansible/run_user.sh b/ansible/run_user.sh new file mode 100644 index 0000000..e52b521 --- /dev/null +++ b/ansible/run_user.sh @@ -0,0 +1 @@ +ansible-playbook -i 'localhost,' -c local user.yml diff --git a/ansible/user.yml b/ansible/user.yml new file mode 100644 index 0000000..a34f6fe --- /dev/null +++ b/ansible/user.yml @@ -0,0 +1,11 @@ +- hosts: all + tasks: + + - name: ensure ~/.vimbackups directory + file: state=directory dest=~/.vimbackups + - name: Ensure dotfile symlinks + file: state=link force=yes src={{item}} dest=~/.{{item|basename}} + with_fileglob: ~/config/ansible/files/dotfiles/minimal/* + - name: Ensure user dotfile symlinks + file: state=link force=yes src={{item}} dest=~/.{{item|basename}} + with_fileglob: ~/config/ansible/files/dotfiles/user/* -- 2.30.2