summaryrefslogtreecommitdiff
path: root/tools/playbooks/multinode_setup/configure_loopback.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/playbooks/multinode_setup/configure_loopback.yaml')
-rw-r--r--tools/playbooks/multinode_setup/configure_loopback.yaml64
1 files changed, 64 insertions, 0 deletions
diff --git a/tools/playbooks/multinode_setup/configure_loopback.yaml b/tools/playbooks/multinode_setup/configure_loopback.yaml
new file mode 100644
index 000000000..7a82e132a
--- /dev/null
+++ b/tools/playbooks/multinode_setup/configure_loopback.yaml
@@ -0,0 +1,64 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+- hosts: storage
+ become: true
+ tasks:
+ - name: assure /srv directory exists
+ file:
+ path: '/srv'
+ state: directory
+
+ - name: create loopback device
+ command: truncate -s 1GB /srv/swift-disk creates=/srv/swift-disk
+
+ - name: create filesystem /srv/swift-disk
+ become: true
+ filesystem: fstype=xfs dev=/srv/swift-disk
+
+ - name: create mount path /mnt/sdb1
+ file:
+ path: '/mnt/sdb1'
+ state: directory
+
+ - name: mount /mnt/sdb1
+ mount: name=/mnt/sdb1 src=/srv/swift-disk fstype=xfs opts="loop,noatime,nodiratime,nobarrier,logbufs=8" dump=0 passno=0 state=mounted
+
+ - name: create sub-partitions
+ file:
+ path: '/mnt/sdb1/{{ item }}'
+ state: directory
+ owner: '{{ ansible_user_id }}'
+ group: '{{ ansible_user_gid }}'
+ with_items:
+ - 1
+
+ - name: create symlinks
+ become: true
+ file:
+ src: '/mnt/sdb1/{{ item }}'
+ dest: '/srv/{{ item }}'
+ owner: '{{ ansible_user_id }}'
+ group: '{{ ansible_user_gid }}'
+ state: link
+ with_items:
+ - 1
+
+ - name: create node partition directories
+ file:
+ path: '/srv/1/node/sdb{{ item }}'
+ owner: '{{ ansible_user_id }}'
+ group: '{{ ansible_user_gid }}'
+ state: directory
+ with_items:
+ - [1, 2, 3, 4, 5, 6, 7, 8]
+