ansible-role-nfs/tasks/main.yml
Nikola Dipanov e7c2f5a175 Make the role work on Fedora systems
The commit makes sure that we include the correct overrides for service
names, and also that we don't assume yum as the package manager since
newer Fedora versions (22 and above) use dnf.

Tested on Fedora 23.
2016-03-11 14:24:57 +00:00

36 lines
1,014 B
YAML

---
# Include variables and define needed variables.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Include overrides specific to RHEL 7.
include_vars: RedHat-7.yml
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
- name: Include overrides specific to Fedora.
include_vars: Fedora.yml
when: ansible_os_family == 'RedHat' and ansible_distribution == "Fedora"
# Setup/install tasks.
- include: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
- include: setup-Debian.yml
when: ansible_os_family == 'Debian'
- name: Ensure directories to export exist
file: path="{{ item.strip().split()[0] }}" state=directory
with_items: nfs_exports
- name: Copy exports file.
template:
src: exports.j2
dest: /etc/exports
owner: root
group: root
mode: 0644
notify: restart nfs
- name: Ensure nfs is running.
service: "name={{ nfs_server_daemon }} state=started enabled=yes"
when: nfs_exports|length