This is not really related to elasticluster, but kind of since I need to attach storage volumes for my cluster.
So maybe people here have some tips anyway.
In my private ansible script I do:
- name: Ensure directories exist
file:
path: "{{ item.path }}"
state: directory
owner: "{{ user_name_grid }}"
group: "{{ group_name_grid }}"
mode: 0755
with_items: "{{ blockstorage }}"
- name: Add mountpoints in fstab
mount:
fstype: "{{ item.fstype }}"
path: "{{ item.path }}"
src: "{{ item.src }}"
state: mounted
with_items: "{{ blockstorage }}"
And I have variables (in /roles/frontend/vars/main.yml)
blockstorage:
- path: '/wlcg'
src: '/dev/sdb'
fstype: 'ext4'
- path: '/grid'
src: '/dev/sdc'
fstype: 'ext4'
TASK [frontend : Ensure directories exist] *******************************************************************************************************************************************************************************************
ok: [frontend001] => (item={u'path': u'/wlcg', u'src': u'/dev/sdb', u'fstype': u'ext4'}) => {"changed": false, "gid": 500, "group": "centos", "item": {"fstype": "ext4", "path": "/wlcg", "src": "/dev/sdb"}, "mode": "0755", "owner": "centos", "path": "/wlcg", "secontext": "unconfined_u:object_r:default_t:s0", "size": 4096, "state": "directory", "uid": 500}
ok: [frontend001] => (item={u'path': u'/grid', u'src': u'/dev/sdc', u'fstype': u'ext4'}) => {"changed": false, "gid": 500, "group": "centos", "item": {"fstype": "ext4", "path": "/grid", "src": "/dev/sdc"}, "mode": "0755", "owner": "centos", "path": "/grid", "secontext": "unconfined_u:object_r:default_t:s0", "size": 4096, "state": "directory", "uid": 500}
TASK [frontend : Add mountpoints in fstab] *******************************************************************************************************************************************************************************************
changed: [frontend001] => (item={u'path': u'/wlcg', u'src': u'/dev/sdb', u'fstype': u'ext4'}) => {"changed": true, "dump": "0", "fstab": "/etc/fstab", "fstype": "ext4", "item": {"fstype": "ext4", "path": "/wlcg", "src": "/dev/sdb"}, "name": "/wlcg", "opts": "defaults", "passno": "0", "src": "/dev/sdb"}
failed: [frontend001] (item={u'path': u'/grid', u'src': u'/dev/sdc', u'fstype': u'ext4'}) => {"failed": true, "item": {"fstype": "ext4", "path": "/grid", "src": "/dev/sdc"}, "msg": "Error mounting /grid: mount: wrong fs type, bad option, bad superblock on /dev/sdc,\n missing codepage or helper program, or other error\n In some cases useful info is found in syslog - try\n dmesg | tail or so\n\n"}
to retry, use: --limit @/home/centos/grid-uh-cloud/ansible/grid_cluster_setup/frontend.retry
Why do I get this failure? I can loginto the machine and perform the ext4 and mount commands by hand. But I would of course like to avoid that.
Maiken