4901942da220389e23fb3c4e9bcefbbc7c4d434b
[ta/infra-ansible.git] / roles / bootstrap-host / tasks / prepare_loopback_swift.yml
1 ---
2 # Copyright 2015, Rackspace US, Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 - name: Create sparse Swift files
17   command: "truncate -s {{ bootstrap_host_loopback_swift_size }}G /openstack/{{ item }}.img"
18   args:
19     creates: "/openstack/{{ item }}.img"
20   with_items:
21     - 'swift1'
22     - 'swift2'
23     - 'swift3'
24   register: swift_create
25   tags:
26     - swift-file-create
27
28 - name: Format the Swift files
29   filesystem:
30     fstype: xfs
31     opts: '-K'
32     dev: "/openstack/{{ item }}.img"
33   when: swift_create | changed
34   with_items:
35     - 'swift1'
36     - 'swift2'
37     - 'swift3'
38   tags:
39     - swift-format-file
40
41 - name: Create the Swift mount points, fstab entries and mount the file systems
42   mount:
43     name: "/srv/{{ item }}.img"
44     src: "/openstack/{{ item }}.img"
45     fstype: xfs
46     opts: 'loop,noatime,nodiratime,nobarrier,logbufs=8'
47     passno: 0
48     dump: 0
49     state: mounted
50   with_items:
51     - 'swift1'
52     - 'swift2'
53     - 'swift3'
54   tags:
55     - swift-file-mount