Skip to content
Snippets Groups Projects
Commit 042ac78b authored by Vladimír Štill's avatar Vladimír Štill
Browse files

ansible: Auto-materialize homes for users added to the home map

parent 99b5d9c5
No related branches found
No related tags found
No related merge requests found
- name: Create homes
block:
- name: "Stat homes"
stat:
path: "/export/home/{{item}}"
register: home
loop: "{{mount.home.pontos[inventory_hostname | regex_replace('pontos([0-9]*).fi.muni.cz', '\\1')]}}"
- name: "Create home dir"
file:
state: directory
path: "/export/home/{{item}}"
owner: "{{item}}"
group: "paradise"
loop: "{{home.results | map(attribute='item')}}"
register: home_created
- name: "Copy skeleton"
copy:
src: "/etc/skel/{{item.1}}"
dest: "/export/home/{{item.0.item}}"
remote_src: true
owner: "{{item.0.item}}"
group: "paradise"
loop: "{{home_created.results | selectattr('changed') | product(['.bash_logout', '.bashrc', '.profile']) | list}}"
when: inventory_hostname == "pontos01.fi.muni.cz" or inventory_hostname == "pontos02.fi.muni.cz" or inventory_hostname == "pontos03.fi.muni.cz" or inventory_hostname == "pontos04.fi.muni.cz"
- name: Setup home exports - name: Setup home exports
template: template:
src: home.exports.j2 src: home.exports.j2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment