forked from IBMSpectrumComputing/lsf-hybrid-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Step5-access-storage.yml
84 lines (72 loc) · 2.5 KB
/
Step5-access-storage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
#-----------------------------------
# Copyright IBM Corp. 1992, 2017. All rights reserved.
# US Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#-----------------------------------
#
---
# --------------------------------------------------------------------------------
# Storage Configuration
# --------------------------------------------------------------------------------
- name: Generate the fstab file
hosts: LSF_Masters[0]
tags: config-storage
tasks:
- name: Load variables
include_vars: Storage-config.yml
- name: Create a fstab.append file
template:
src: "{{ RC_PLAY_TOP }}/template/fstab.j2"
dest: "{{ RC_PLAY_TOP }}/files/fstab.append"
- name: Reload EC2 server inventory
include_vars: "{{ RC_PLAY_TOP }}/inventory_ec2servers.yml"
- name: Make a hostgroup from the private IPs for ansible to connect to
add_host:
hostname: "{{ item.prv_ip }}"
groupname: ec2servers
with_items: "{{ ec2servers }}"
ignore_errors: True
- name: Copy the fstab to the Cloud nodes
hosts: ec2servers
vars_files:
- AWS/AWS-config.yml
gather_facts: true
tags: config-storage
vars:
ansible_ssh_private_key_file: "{{ AWS_Private_Key_File }}"
tasks:
- name: Load variables
include_vars: "{{ RC_PLAY_TOP }}/Storage-config.yml"
ignore_errors: True
- name: Copy the fstab extensions to the cloud machines
copy:
src: "{{ RC_PLAY_TOP }}/files/fstab.append"
dest: /etc/fstab.append
ignore_errors: True
when:
- sharedir is defined
- name: Merge the fstab entries
shell: grep -q Storage-config /etc/fstab || cat /etc/fstab.append >> /etc/fstab
args:
executable: /bin/bash
warn: no
ignore_errors: True
when:
- sharedir is defined
- name: Make the needed directories
shell: test -d "{{ item }}" || mkdir -p "{{ item }}"
args:
executable: /bin/bash
warn: no
with_items:
- "{% set list1 = [] %}{% for i in sharedir %}{% if list1.append( i.mountpnt ) %}{% endif %}{% endfor %}{{ list1 }}"
ignore_errors: True
when:
- sharedir is defined
- name: Warning
debug:
msg: WARNING if there is a problem with the fstab entries it can cause the play to block indefinately!
- name: Mounting Storage from on premises network
shell: mount -a
ignore_errors: True