|
119 | 119 | path: /run/docker.sock |
120 | 120 | mode: 0666 |
121 | 121 | become: true |
| 122 | + |
| 123 | + # On RAX hosts, we have a small root partition and a large, |
| 124 | + # unallocated ephemeral device attached at /dev/xvde |
| 125 | + - name: Set ephemeral device if /dev/xvde exists |
| 126 | + when: ansible_devices["xvde"] is defined |
| 127 | + set_fact: |
| 128 | + ephemeral_device: "/dev/xvde" |
| 129 | + |
| 130 | + # On other providers, we have a device called "ephemeral0". |
| 131 | + - name: Set ephemeral device by label |
| 132 | + when: ephemeral_device is undefined |
| 133 | + block: |
| 134 | + - name: Get ephemeral0 device node |
| 135 | + command: /sbin/blkid -L ephemeral0 |
| 136 | + register: ephemeral0 |
| 137 | + # rc !=0 is expected |
| 138 | + failed_when: False |
| 139 | + changed_when: False |
| 140 | + |
| 141 | + - name: Set ephemeral device if LABEL exists |
| 142 | + when: "ephemeral0.rc == 0" |
| 143 | + set_fact: |
| 144 | + ephemeral_device: "{{ ephemeral0.stdout }}" |
| 145 | + |
| 146 | + - name: Configure additional disk (if available) |
| 147 | + become: true |
| 148 | + when: ephemeral_device is defined |
| 149 | + block: |
| 150 | + - name: Ensure ephemeral device is unmounted |
| 151 | + ansible.posix.mount: |
| 152 | + name: "{{ ephemeral_device }}" |
| 153 | + state: "{{ item }}" |
| 154 | + loop: |
| 155 | + - unmounted |
| 156 | + - absent |
| 157 | + |
| 158 | + - name: Get existing partitions |
| 159 | + community.general.parted: |
| 160 | + device: "{{ ephemeral_device }}" |
| 161 | + unit: MiB |
| 162 | + state: info |
| 163 | + register: ephemeral_partitions |
| 164 | + |
| 165 | + - name: Remove any existing partitions |
| 166 | + community.general.parted: |
| 167 | + device: "{{ ephemeral_device }}" |
| 168 | + number: "{{ item.num }}" |
| 169 | + state: absent |
| 170 | + loop: "{{ ephemeral_partitions.partitions }}" |
| 171 | + |
| 172 | + - name: Create filesystem on additional partition |
| 173 | + community.general.filesystem: |
| 174 | + fstype: ext4 |
| 175 | + dev: "{{ ephemeral_device }}" |
| 176 | + opts: "-L kolla" |
| 177 | + |
| 178 | + - name: Ensure /mnt/kolla mountpoint is created |
| 179 | + ansible.builtin.file: |
| 180 | + path: "/mnt/kolla" |
| 181 | + owner: root |
| 182 | + group: root |
| 183 | + state: directory |
| 184 | + mode: 0755 |
| 185 | + |
| 186 | + - name: Mount additional filesystem |
| 187 | + ansible.posix.mount: |
| 188 | + path: "/mnt/kolla" |
| 189 | + src: "LABEL=kolla" |
| 190 | + fstype: ext4 |
| 191 | + state: present |
| 192 | + |
| 193 | + - name: Ensure /mnt/kolla/work_dir directory is created |
| 194 | + ansible.builtin.file: |
| 195 | + path: "/mnt/kolla/work_dir" |
| 196 | + owner: root |
| 197 | + group: root |
| 198 | + state: directory |
| 199 | + mode: 0777 |
0 commit comments