2014-03-05 04:38:18 +01:00
|
|
|
---
|
2015-02-22 21:46:04 +01:00
|
|
|
# Include variables and define needed variables.
|
|
|
|
- name: Include OS-specific variables.
|
|
|
|
include_vars: "{{ ansible_os_family }}.yml"
|
2016-02-02 04:49:25 +01:00
|
|
|
|
2016-02-02 18:11:07 +01:00
|
|
|
- name: Include overrides specific to RHEL 7.
|
|
|
|
include_vars: RedHat-7.yml
|
2016-02-02 04:49:25 +01:00
|
|
|
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
|
2015-02-22 21:46:04 +01:00
|
|
|
|
2016-03-11 15:24:57 +01:00
|
|
|
- name: Include overrides specific to Fedora.
|
|
|
|
include_vars: Fedora.yml
|
|
|
|
when: ansible_os_family == 'RedHat' and ansible_distribution == "Fedora"
|
|
|
|
|
2014-11-12 21:18:52 +01:00
|
|
|
# Setup/install tasks.
|
|
|
|
- include: setup-RedHat.yml
|
|
|
|
when: ansible_os_family == 'RedHat'
|
2014-03-05 04:38:18 +01:00
|
|
|
|
2014-11-12 21:18:52 +01:00
|
|
|
- include: setup-Debian.yml
|
|
|
|
when: ansible_os_family == 'Debian'
|
2014-11-12 22:02:07 +01:00
|
|
|
|
2016-02-02 04:50:55 +01:00
|
|
|
- name: Ensure directories to export exist
|
2016-03-11 17:43:51 +01:00
|
|
|
file: 'path="{{ item.strip().split()[0] }}" state=directory'
|
2016-03-11 17:47:32 +01:00
|
|
|
with_items: "{{ nfs_exports }}"
|
2016-03-11 17:43:51 +01:00
|
|
|
notify: restart nfs
|
2016-02-02 04:50:55 +01:00
|
|
|
|
2014-11-12 22:02:07 +01:00
|
|
|
- name: Copy exports file.
|
|
|
|
template:
|
|
|
|
src: exports.j2
|
|
|
|
dest: /etc/exports
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2016-03-12 04:40:30 +01:00
|
|
|
register: nfs_exports_copy
|
2015-02-22 21:59:26 +01:00
|
|
|
notify: restart nfs
|
2014-11-12 22:02:07 +01:00
|
|
|
|
2016-03-12 04:40:30 +01:00
|
|
|
- name: Restart NFS immediately if exports are updated.
|
|
|
|
service: "name={{ nfs_server_daemon }} state=restarted"
|
|
|
|
when: nfs_exports_copy.changed
|
|
|
|
|
2015-03-24 22:58:08 +01:00
|
|
|
- name: Ensure nfs is running.
|
|
|
|
service: "name={{ nfs_server_daemon }} state=started enabled=yes"
|
2015-02-22 21:59:26 +01:00
|
|
|
when: nfs_exports|length
|