summaryrefslogtreecommitdiffstats
path: root/roles/openshift_nfs/tasks/create_export.yml
blob: 5fcdbf76e4818dd3928c1bbd5cbfee863b3d1dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
# Makes a new NFS export
#
# Include signature
#
# include_role:
#   role: openshift_nfs
#   tasks_from: create_export
# vars:
#   l_nfs_base_dir: Base dir to exports
#   l_nfs_export_config: Name to prefix the .exports file with
#   l_nfs_export_name: Name of sub-directory of the export
#   l_nfs_options: Mount Options

- name: "Ensure {{ l_nfs_export_name }} NFS export directory exists"
  file:
    path: "{{ l_nfs_base_dir }}/{{ l_nfs_export_name }}"
    state: directory
    mode: 0777
    owner: nfsnobody
    group: nfsnobody

- name: "Create {{ l_nfs_export_name }} NFS export"
  lineinfile:
    path: "/etc/exports.d/{{ l_nfs_export_config }}.exports"
    create: true
    state: present
    line: "{{ l_nfs_base_dir }}/{{ l_nfs_export_name }} {{ l_nfs_options }}"
  register: created_export

- name: Re-export NFS filesystems
  command: exportfs -ar
  when:
    - created_export is changed