From c19915251f597242d54335d8c8f8e69012be2cb8 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 --- playbooks/roles/os_glance/defaults/main.yml | 4 ++-- playbooks/roles/os_glance/handlers/main.yml | 9 --------- .../roles/os_glance/tasks/glance_post_install.yml | 15 ++++++++------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/playbooks/roles/os_glance/defaults/main.yml b/playbooks/roles/os_glance/defaults/main.yml index cc60b68454..225fe0e7ac 100644 --- a/playbooks/roles/os_glance/defaults/main.yml +++ b/playbooks/roles/os_glance/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/playbooks/roles/os_glance/handlers/main.yml b/playbooks/roles/os_glance/handlers/main.yml index 94c28780b5..51a586ef21 100644 --- a/playbooks/roles/os_glance/handlers/main.yml +++ b/playbooks/roles/os_glance/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/playbooks/roles/os_glance/tasks/glance_post_install.yml b/playbooks/roles/os_glance/tasks/glance_post_install.yml index afc350d83e..6b48ceea55 100644 --- a/playbooks/roles/os_glance/tasks/glance_post_install.yml +++ b/playbooks/roles/os_glance/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