|
26 | 26 | when: lsblk_disk.stdout is defined and lsblk_disk.stdout | length < 1 |
27 | 27 |
|
28 | 28 | # Filesystem |
29 | | - - name: Create "{{ pg_data_mount_fstype | default('ext4') }}" filesystem on the disk "/dev/{{ lsblk_disk.stdout | default('') }}" |
| 29 | + - name: Create "{{ postgresql_data_dir_mount_fstype | default('ext4') }}" filesystem on the disk "/dev/{{ lsblk_disk.stdout | default('') }}" |
30 | 30 | community.general.filesystem: |
31 | 31 | dev: "/dev/{{ lsblk_disk.stdout }}" |
32 | | - fstype: "{{ pg_data_mount_fstype | default('ext4') }}" |
| 32 | + fstype: "{{ postgresql_data_dir_mount_fstype | default('ext4') }}" |
33 | 33 | when: |
34 | 34 | - (lsblk_disk.stdout is defined and lsblk_disk.stdout | length > 0) |
35 | | - - ((pg_data_mount_fstype is defined and pg_data_mount_fstype != 'zfs') or |
36 | | - (pg_data_mount_fstype is not defined and mount[0].fstype != 'zfs')) |
| 35 | + - ((postgresql_data_dir_mount_fstype is defined and postgresql_data_dir_mount_fstype != 'zfs') or |
| 36 | + (postgresql_data_dir_mount_fstype is not defined and mount[0].fstype != 'zfs')) |
37 | 37 |
|
38 | 38 | # UUID |
39 | 39 | - name: Get UUID of the disk "/dev/{{ lsblk_disk.stdout | default('') }}" |
|
46 | 46 | changed_when: false |
47 | 47 | when: |
48 | 48 | - (lsblk_disk.stdout is defined and lsblk_disk.stdout | length > 0) |
49 | | - - ((pg_data_mount_fstype is defined and pg_data_mount_fstype != 'zfs') or |
50 | | - (pg_data_mount_fstype is not defined and mount[0].fstype != 'zfs')) |
| 49 | + - ((postgresql_data_dir_mount_fstype is defined and postgresql_data_dir_mount_fstype != 'zfs') or |
| 50 | + (postgresql_data_dir_mount_fstype is not defined and mount[0].fstype != 'zfs')) |
51 | 51 |
|
52 | 52 | - name: "Set mount variables" |
53 | 53 | ansible.builtin.set_fact: |
54 | 54 | mount: |
55 | 55 | - src: "UUID={{ lsblk_uuid.stdout }}" |
56 | | - path: "{{ pg_data_mount_path | default('/pgdata', true) }}" |
57 | | - fstype: "{{ pg_data_mount_fstype | default('ext4', true) }}" |
| 56 | + path: "{{ postgresql_data_dir_mount_path | default('/pgdata', true) }}" |
| 57 | + fstype: "{{ postgresql_data_dir_mount_fstype | default('ext4', true) }}" |
58 | 58 | when: lsblk_uuid.stdout is defined |
59 | 59 |
|
60 | 60 | # Mount |
61 | 61 | - name: Mount the filesystem |
62 | 62 | ansible.posix.mount: |
63 | 63 | path: "{{ item.path }}" |
64 | 64 | src: "{{ item.src }}" |
65 | | - fstype: "{{ item.fstype | default(pg_data_mount_fstype | default('ext4', true), true) }}" |
| 65 | + fstype: "{{ item.fstype | default(postgresql_data_dir_mount_fstype | default('ext4', true), true) }}" |
66 | 66 | opts: "{{ item.opts | default('defaults,noatime') }}" |
67 | 67 | state: "{{ item.state | default('mounted') }}" |
68 | 68 | loop: "{{ mount }}" |
69 | 69 | when: |
70 | 70 | - (item.src | length > 0 and item.path | length > 0) |
71 | | - - ((pg_data_mount_fstype is defined and pg_data_mount_fstype != 'zfs') or |
72 | | - (pg_data_mount_fstype is not defined and item.fstype != 'zfs')) |
| 71 | + - ((postgresql_data_dir_mount_fstype is defined and postgresql_data_dir_mount_fstype != 'zfs') or |
| 72 | + (postgresql_data_dir_mount_fstype is not defined and item.fstype != 'zfs')) |
73 | 73 |
|
74 | 74 | # ZFS Pool (if fstype is 'zfs') |
75 | 75 | - block: |
|
150 | 150 | -O atime=off |
151 | 151 | -O recordsize=128k |
152 | 152 | -O logbias=throughput |
153 | | - -m {{ pg_data_mount_path | default(mount[0].path | default('/pgdata', true), true) }} |
| 153 | + -m {{ postgresql_data_dir_mount_path | default(mount[0].path | default('/pgdata', true), true) }} |
154 | 154 | pgdata {{ mount[0].src | default("/dev/" + lsblk_disk.stdout, true) }} |
155 | 155 | when: |
156 | 156 | - (mount[0].src | length > 0 or lsblk_disk.stdout | default('') | length > 0) |
157 | | - - ((pg_data_mount_fstype is defined and pg_data_mount_fstype == 'zfs') or |
158 | | - (pg_data_mount_fstype is not defined and mount[0].fstype == 'zfs')) |
| 157 | + - ((postgresql_data_dir_mount_fstype is defined and postgresql_data_dir_mount_fstype == 'zfs') or |
| 158 | + (postgresql_data_dir_mount_fstype is not defined and mount[0].fstype == 'zfs')) |
159 | 159 | tags: mount, zpool |
0 commit comments