From 974a3c3bf5b71cd6b07c1b4b51044bc535ff4456 Mon Sep 17 00:00:00 2001 From: baigk Date: Wed, 5 Aug 2015 01:31:07 -0400 Subject: support deployment openstack juno with ansible for compass in ubuntu 14.04 JIRA: COMPASS-4 Change-Id: I7adc565325c2a0cbf878b2aea022b31d118748dd Signed-off-by: baigk --- deploy/adapters/ansible/roles/glance/tasks/nfs.yml | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 deploy/adapters/ansible/roles/glance/tasks/nfs.yml (limited to 'deploy/adapters/ansible/roles/glance/tasks/nfs.yml') diff --git a/deploy/adapters/ansible/roles/glance/tasks/nfs.yml b/deploy/adapters/ansible/roles/glance/tasks/nfs.yml new file mode 100644 index 00000000..70ed91d5 --- /dev/null +++ b/deploy/adapters/ansible/roles/glance/tasks/nfs.yml @@ -0,0 +1,42 @@ +--- +- name: install packages + action: "{{ ansible_pkg_mgr }} name=nfs-common state=present" + with_items: nfs-packages + +- name: install nfs + local_action: yum name=nfs-utils state=present + run_once: True + +- name: create image directory + local_action: file path=/opt/images state=directory mode=0777 + run_once: True + +- name: update nfs config + local_action: lineinfile dest=/etc/exports state=present + regexp="/opt/images *(rw,insecure,sync,all_squash)" + line="/opt/images *(rw,insecure,sync,all_squash)" + run_once: True + +- name: restart nfs service + local_action: service name={{ item }} state=restarted enabled=yes + with_items: + - rpcbind + - nfs + run_once: True + +- name: get mount info + command: mount + register: mount_info + +- name: get nfs server + shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf + register: ip_info + +- name: mount image directory + shell: | + mount -t nfs -onfsvers=3 {{ ip_info.stdout_lines[0] }}:/opt/images /var/lib/glance/images + sed -i '/\/var\/lib\/glance\/images/d' /etc/fstab + echo {{ ip_info.stdout_lines[0] }}:/opt/images /var/lib/glance/images/ nfs nfsvers=3 >> /etc/fstab + when: mount_info.stdout.find('images') == -1 + retries: 5 + delay: 3 -- cgit 1.2.3-korg