# HG changeset patch # User Oleksandr Gavenko # Date 1699824131 -7200 # Node ID 20761b40404f432847d5a36a950b0012b8bd8765 # Parent 50902745d28ca649e121306931c170d106362029 Helper to unpack mini TAR on Ansible managed remote hosts. diff -r 50902745d28c -r 20761b40404f skel-mini.ansible.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/skel-mini.ansible.yaml Sun Nov 12 23:22:11 2023 +0200 @@ -0,0 +1,35 @@ +# Usage without the user (for current ssh user): +# ansible-playbook skel-mini.ansible.yaml +# Usage with the user name: +# ansible-playbook skel-mini.ansible.yaml -e user=... + +- hosts: + - all + strategy: free + + tasks: + - when: user is undefined + become: no + block: + - setup: + gather_subset: + - '!all' + - '!min' + - user_dir + - unarchive: + src: skel-mini.tar.gz + dest: "{{ ansible_user_dir }}" + mode: u=rw,g=r,o=r + + - when: user is defined + become: yes + block: + - getent: + database: passwd + key: "{{ user }}" + - unarchive: + src: skel-mini.tar.gz + dest: "{{ ansible_facts.getent_passwd[user][4] }}" + mode: u=rw,g=r,o=r + owner: "{{ user }}" +