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

ansible: Export homes to anna RO, only webs RW

parent fe979fec
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,14 @@ mount:
export_to:
- antea.fi.muni.cz
- arke.fi.muni.cz
- anna.fi.muni.cz
- pontos*.fi.muni.cz
- pythia*.fi.muni.cz
- pheme*.fi.muni.cz
- pandora*.fi.muni.cz
export_ro_to:
- anna.fi.muni.cz
export_web_to: # must be full hostnames
- anna.fi.muni.cz
home:
pontos:
"01":
......
- name: export nfs
command: exportfs -rav
notify:
- restart autofs
- name: restart autofs
systemd:
name: autofs
state: restarted
- name: export nfs
command: exportfs -rav
......@@ -15,6 +15,14 @@
loop: "{{home.results | map(attribute='item')}}"
register: home_created
- name: "Create public_html dir"
file:
state: directory
path: "/export/home/{{item}}/public_html"
owner: "{{item}}"
group: "paradise"
loop: "{{home.results | map(attribute='item')}}"
- name: "Copy skeleton"
copy:
src: "/etc/skel/{{item.1}}"
......@@ -78,3 +86,28 @@
loop: ['home', 'pontos', 'antea']
notify:
- restart autofs
- name: Web autofs mounts
block:
- name: Userweb directory
file:
state: directory
path: /srv/userweb
- name: Master autofs for web
copy:
content: |
# managed by ansible
/srv/userweb/ {{autofs_prefix}}/auto.userweb -t 300,strictexpire
dest: '{{autofs_prefix}}/auto.master.d/userweb.autofs'
notify:
- restart autofs
- name:
template:
src: 'auto.userweb.j2'
dest: '{{autofs_prefix}}/auto.userweb'
lstrip_blocks: true
notify:
- restart autofs
when: inventory_hostname in mount.export_web_to
......@@ -3,7 +3,13 @@
{% if "pontos" + num + ".fi.muni.cz" == inventory_hostname %}
{% for usr in homes %}
{% for to in mount.export_to %}
/export/home/{{usr}} -rw,no_subtree_check,root_squash,async,mp=/home {{to}}
/export/home/{{usr}} -rw,no_subtree_check,root_squash,async,mp=/export/home {{to}}
{% endfor %}
{% for to in mount.export_ro_to %}
/export/home/{{usr}} -ro,no_subtree_check,root_squash,async,mp=/export/home {{to}}
{% endfor %}
{% for to in mount.export_web_to %}
/export/home/{{usr}}/public_html -rw,no_subtree_check,root_squash,async,mp=/export/home {{to}}
{% endfor %}
{% endfor %}
{% endif %}
......
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