skel-mini.ansible.yaml
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 11 Dec 2023 00:27:20 +0200
changeset 1037 b386e087b97f
parent 1028 20761b40404f
permissions -rw-r--r--
Added workaround for Cygwin, npm authors explicitly forbids it: npm/lib/commands/completion.js if (isWindowsShell) { const msg = 'npm completion supported only in MINGW / Git bash on Windows' throw Object.assign(new Error(msg), {

# 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 }}"