author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 01 Jan 2024 20:53:49 +0200 | |
changeset 1039 | 78cdb4a057e3 |
parent 1028 | 20761b40404f |
permissions | -rw-r--r-- |
1028
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
# Usage without the user (for current ssh user): |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
# ansible-playbook skel-mini.ansible.yaml |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
3 |
# Usage with the user name: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
# ansible-playbook skel-mini.ansible.yaml -e user=... |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
|
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
- hosts: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
- all |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
8 |
strategy: free |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
|
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
tasks: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
- when: user is undefined |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
12 |
become: no |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
block: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
14 |
- setup: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
15 |
gather_subset: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
16 |
- '!all' |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
17 |
- '!min' |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
18 |
- user_dir |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
19 |
- unarchive: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
20 |
src: skel-mini.tar.gz |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
21 |
dest: "{{ ansible_user_dir }}" |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
22 |
mode: u=rw,g=r,o=r |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
23 |
|
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
24 |
- when: user is defined |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
25 |
become: yes |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
26 |
block: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
27 |
- getent: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
28 |
database: passwd |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
29 |
key: "{{ user }}" |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
30 |
- unarchive: |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
31 |
src: skel-mini.tar.gz |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
32 |
dest: "{{ ansible_facts.getent_passwd[user][4] }}" |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
33 |
mode: u=rw,g=r,o=r |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
34 |
owner: "{{ user }}" |
20761b40404f
Helper to unpack mini TAR on Ansible managed remote hosts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
35 |