|
20 | 20 | path: "{{ kolla_build_logs_dir }}" |
21 | 21 | state: directory |
22 | 22 |
|
| 23 | + # On RAX hosts, we have a small root partition and a large, |
| 24 | + # unallocated ephemeral device attached at /dev/xvde |
| 25 | + - name: Set ephemeral device if /dev/xvde exists |
| 26 | + when: ansible_devices["xvde"] is defined |
| 27 | + set_fact: |
| 28 | + ephemeral_device: "/dev/xvde" |
| 29 | + |
| 30 | + # On other providers, we have a device called "ephemeral0". |
| 31 | + - name: Set ephemeral device by label |
| 32 | + when: ephemeral_device is undefined |
| 33 | + block: |
| 34 | + - name: Get ephemeral0 device node |
| 35 | + command: /sbin/blkid -L ephemeral0 |
| 36 | + register: ephemeral0 |
| 37 | + # rc !=0 is expected |
| 38 | + failed_when: False |
| 39 | + changed_when: False |
| 40 | + |
| 41 | + - name: Set ephemeral device if LABEL exists |
| 42 | + when: "ephemeral0.rc == 0" |
| 43 | + set_fact: |
| 44 | + ephemeral_device: "{{ ephemeral0.stdout }}" |
| 45 | + |
| 46 | + - name: Configure additional disk (if available) |
| 47 | + become: true |
| 48 | + when: ephemeral_device is defined |
| 49 | + block: |
| 50 | + - name: Ensure ephemeral device is unmounted |
| 51 | + ansible.posix.mount: |
| 52 | + name: "{{ ephemeral_device }}" |
| 53 | + state: "{{ item }}" |
| 54 | + loop: |
| 55 | + - unmounted |
| 56 | + - absent |
| 57 | + |
| 58 | + - name: Get existing partitions |
| 59 | + community.general.parted: |
| 60 | + device: "{{ ephemeral_device }}" |
| 61 | + unit: MiB |
| 62 | + state: info |
| 63 | + register: ephemeral_partitions |
| 64 | + |
| 65 | + - name: Remove any existing partitions |
| 66 | + community.general.parted: |
| 67 | + device: "{{ ephemeral_device }}" |
| 68 | + number: "{{ item.num }}" |
| 69 | + state: absent |
| 70 | + loop: "{{ ephemeral_partitions.partitions }}" |
| 71 | + |
| 72 | + - name: Create filesystem on additional partition |
| 73 | + community.general.filesystem: |
| 74 | + fstype: ext4 |
| 75 | + dev: "{{ ephemeral_device }}" |
| 76 | + opts: "-L kolla" |
| 77 | + |
| 78 | + - name: Ensure /var/lib/docker mountpoint is created |
| 79 | + ansible.builtin.file: |
| 80 | + path: "/var/lib/docker" |
| 81 | + owner: root |
| 82 | + group: root |
| 83 | + state: directory |
| 84 | + mode: 0755 |
| 85 | + |
| 86 | + - name: Mount additional filesystem |
| 87 | + ansible.posix.mount: |
| 88 | + path: "/var/lib/docker" |
| 89 | + src: "LABEL=kolla" |
| 90 | + fstype: ext4 |
| 91 | + state: mounted |
| 92 | + |
23 | 93 | - name: Install Python3 setuptools and family |
24 | 94 | package: |
25 | 95 | name: |
|
0 commit comments