From ac85a73b3931e95a37c3d7a53f4b81229c372ec9 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Wed, 22 Jul 2015 11:41:26 +0100 Subject: [PATCH] Fix glance_nfs_client setting glance_nfs_client adds 2 fstab entries, with then handler entry being incorrectly ordered (src and name are the wrong way around). This patch removes the redundant handler and moves the existing fstab task to use the "mount" module which will add the entry to fstab and ensure the filesystems are mounted. Additionally this fixes a documentation bug where an incorrect variable is referenced (glance_nfs_mounts). Change-Id: I6e0f964d4279800d31119f380a239e2c4ae61cb5 Fixes-Bug: #1477081 --- defaults/main.yml | 4 ++-- handlers/main.yml | 9 --------- tasks/glance_post_install.yml | 15 ++++++++------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index cc60b684..225fe0e7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -117,9 +117,9 @@ glance_policy_dirs: policy.d ## Define nfs information for glance. When the glance_nfs_client dictionary is ## defined it will enable nfs shares as mounted directories. The -## ``glance_nfs_mounts`` value is a list of dictionaries that must be filled +## ``glance_nfs_client`` value is a list of dictionaries that must be filled ## out completely to enable the persistent NFS mounts. -# glance_nfs_mounts: +# glance_nfs_client: # - server: "127.0.0.1" ## Hostname or IP address of NFS Server # remote_path: "/images" ## Remote path from the NFS server's export # local_path: "/var/lib/glance/images" ## Local path on machine diff --git a/handlers/main.yml b/handlers/main.yml index 94c28780..51a586ef 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -31,12 +31,3 @@ state: "restarted" pattern: "{{ item }}" with_items: glance_service_names - -- name: Glance mount nfs - mount: - name: "{{ item.server }}:{{ item.remote_path }}" - src: "{{ item.local_path }}" - fstype: "{{ item.type }}" - opts: "{{ item.options }}" - state: "present" - with_items: glance_nfs_client diff --git a/tasks/glance_post_install.yml b/tasks/glance_post_install.yml index afc350d8..6b48ceea 100644 --- a/tasks/glance_post_install.yml +++ b/tasks/glance_post_install.yml @@ -94,15 +94,16 @@ - glance-nfs - glance-nfs-local-path -- name: Create nfs mounts - lineinfile: - dest: "/etc/fstab" - line: "{{ item.server }}:{{ item.remote_path }} {{ item.local_path }} {{ item.type }} {{ item.options }} 0 0" - backup: "true" +- name: Glance mount nfs + mount: + name: "{{ item.local_path }}" + src: "{{ item.server }}:{{ item.remote_path }}" + fstype: "{{ item.type }}" + opts: "{{ item.options }}" + state: "mounted" with_items: glance_nfs_client when: > glance_nfs_client is defined - notify: Glance mount nfs tags: - glance-nfs - - glance-nfs-fstab + - glance-nfs-local-path