2 # Copyright 2016, Logan Vig <logan2211@gmail.com>
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 - name: Create sparse ceph OSD files
17 command: truncate -s {{ bootstrap_host_loopback_ceph_size }}G /openstack/{{ item }}.img
19 creates: "/openstack/{{ item }}.img"
20 with_items: "{{ ceph_osd_images }}"
26 - name: Create the ceph loopback device
27 command: losetup -f /openstack/{{ item.item }}.img --show
28 with_items: "{{ ceph_create.results }}"
29 register: ceph_create_loopback
30 when: not item|skipped
35 - name: Ensure that rc.local exists
43 - name: Create ceph loopback at boot time
46 line: "losetup -f /openstack/{{ item }}.img"
47 with_items: "{{ ceph_osd_images }}"
49 # TODO(logan): Move these vars to user_variables.ceph.yml.j2 once LP #1649381
50 # is fixed and eliminate this task.
51 - name: Write ceph cluster config
55 devices: {{ ceph_create_loopback.results | map(attribute='stdout') | list | to_yaml | trim }}
56 # The OSA ceph_client role does not support loading IPs from an inventory group,
57 # so we have to feed it a list of IPs
58 ceph_mons: "{% raw %}[ {% for host in groups[mon_group_name] %}'{{ hostvars[host]['ansible_host'] }}'{% if not loop.last %},{% endif %}{% endfor %} ]{% endraw %}"
61 volume_driver: cinder.volume.drivers.rbd.RBDDriver
63 rbd_ceph_conf: /etc/ceph/ceph.conf
64 rbd_store_chunk_size: 8
65 volume_backend_name: rbddriver
67 rbd_secret_uuid: "{% raw %}{{ cinder_ceph_client_uuid }}{% endraw %}"
68 report_discard_supported: true
69 dest: /etc/openstack_deploy/user_ceph_aio.yml
72 when: not ceph_create_loopback|skipped