From ec9c22ca6a376b7d1139a384dcb78f3f5bb5b607 Mon Sep 17 00:00:00 2001 From: Russell Teague Date: Fri, 18 Nov 2016 14:26:02 -0500 Subject: Refactored to use Ansible systemd module * Ansible systemd module used in place of service module * Refactored command tasks which are no longer necessary * Applying rules from openshift-ansible Best Practices Guide --- roles/kube_nfs_volumes/README.md | 2 +- roles/kube_nfs_volumes/handlers/main.yml | 2 +- roles/kube_nfs_volumes/meta/main.yml | 2 +- roles/kube_nfs_volumes/tasks/nfs.yml | 10 ++++++++-- 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'roles/kube_nfs_volumes') diff --git a/roles/kube_nfs_volumes/README.md b/roles/kube_nfs_volumes/README.md index dd91ad8b1..8cf7c0cd4 100644 --- a/roles/kube_nfs_volumes/README.md +++ b/roles/kube_nfs_volumes/README.md @@ -11,8 +11,8 @@ system) on the disks! ## Requirements +* Ansible 2.2 * Running Kubernetes with NFS persistent volume support (on a remote machine). - * Works only on RHEL/Fedora-like distros. ## Role Variables diff --git a/roles/kube_nfs_volumes/handlers/main.yml b/roles/kube_nfs_volumes/handlers/main.yml index 52f3ceffe..9ce8b783d 100644 --- a/roles/kube_nfs_volumes/handlers/main.yml +++ b/roles/kube_nfs_volumes/handlers/main.yml @@ -1,3 +1,3 @@ --- - name: restart nfs - service: name=nfs-server state=restarted + systemd: name=nfs-server state=restarted diff --git a/roles/kube_nfs_volumes/meta/main.yml b/roles/kube_nfs_volumes/meta/main.yml index dc4ccdfee..be6ca6b88 100644 --- a/roles/kube_nfs_volumes/meta/main.yml +++ b/roles/kube_nfs_volumes/meta/main.yml @@ -4,7 +4,7 @@ galaxy_info: description: Partition disks and use them as Kubernetes NFS physical volumes. company: Red Hat, Inc. license: license (Apache) - min_ansible_version: 1.4 + min_ansible_version: 2.2 platforms: - name: EL versions: diff --git a/roles/kube_nfs_volumes/tasks/nfs.yml b/roles/kube_nfs_volumes/tasks/nfs.yml index ebd3d349a..9eeff9260 100644 --- a/roles/kube_nfs_volumes/tasks/nfs.yml +++ b/roles/kube_nfs_volumes/tasks/nfs.yml @@ -4,10 +4,16 @@ when: not openshift.common.is_containerized | bool - name: Start rpcbind on Fedora/Red Hat - service: name=rpcbind state=started enabled=yes + systemd: + name: rpcbind + state: started + enabled: yes - name: Start nfs on Fedora/Red Hat - service: name=nfs-server state=started enabled=yes + systemd: + name: nfs-server + state: started + enabled: yes - name: Export the directories lineinfile: dest=/etc/exports -- cgit v1.2.3