| 1 |
--- |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
- name: Create disk image |
| 7 |
command: 'dd if=/dev/zero of={{ remote_tmp_dir }}/img-gquota bs=1M count=400 |
| 8 |
|
| 9 |
' |
| 10 |
- name: Create XFS filesystem |
| 11 |
filesystem: |
| 12 |
dev: '{{ remote_tmp_dir }}/img-gquota' |
| 13 |
fstype: xfs |
| 14 |
- block: |
| 15 |
- name: Mount filesystem |
| 16 |
become: true |
| 17 |
ansible.posix.mount: |
| 18 |
fstab: '{{ remote_tmp_dir }}/fstab' |
| 19 |
src: '{{ remote_tmp_dir }}/img-gquota' |
| 20 |
path: '{{ remote_tmp_dir }}/gquota' |
| 21 |
fstype: xfs |
| 22 |
opts: gquota |
| 23 |
state: mounted |
| 24 |
- name: Apply default group limits |
| 25 |
xfs_quota: |
| 26 |
bsoft: '{{ gquota_default_bsoft }}' |
| 27 |
bhard: '{{ gquota_default_bhard }}' |
| 28 |
isoft: '{{ gquota_default_isoft }}' |
| 29 |
ihard: '{{ gquota_default_ihard }}' |
| 30 |
mountpoint: '{{ remote_tmp_dir }}/gquota' |
| 31 |
rtbsoft: '{{ gquota_default_rtbsoft }}' |
| 32 |
rtbhard: '{{ gquota_default_rtbhard }}' |
| 33 |
type: group |
| 34 |
become: true |
| 35 |
register: test_gquota_default_before |
| 36 |
- name: Assert default group limits results |
| 37 |
assert: |
| 38 |
that: |
| 39 |
- test_gquota_default_before.changed |
| 40 |
- test_gquota_default_before.bsoft == gquota_default_bsoft|human_to_bytes |
| 41 |
- test_gquota_default_before.bhard == gquota_default_bhard|human_to_bytes |
| 42 |
- test_gquota_default_before.isoft == gquota_default_isoft |
| 43 |
- test_gquota_default_before.ihard == gquota_default_ihard |
| 44 |
- test_gquota_default_before.rtbsoft == gquota_default_rtbsoft|human_to_bytes |
| 45 |
- test_gquota_default_before.rtbhard == gquota_default_rtbhard|human_to_bytes |
| 46 |
- name: Apply group limits |
| 47 |
xfs_quota: |
| 48 |
bsoft: '{{ gquota_group_bsoft }}' |
| 49 |
bhard: '{{ gquota_group_bhard }}' |
| 50 |
isoft: '{{ gquota_group_isoft }}' |
| 51 |
ihard: '{{ gquota_group_ihard }}' |
| 52 |
mountpoint: '{{ remote_tmp_dir }}/gquota' |
| 53 |
name: xfsquotauser |
| 54 |
rtbsoft: '{{ gquota_group_rtbsoft }}' |
| 55 |
rtbhard: '{{ gquota_group_rtbhard }}' |
| 56 |
type: group |
| 57 |
become: true |
| 58 |
register: test_gquota_group_before |
| 59 |
- name: Assert group limits results for xfsquotauser |
| 60 |
assert: |
| 61 |
that: |
| 62 |
- test_gquota_group_before.changed |
| 63 |
- test_gquota_group_before.bsoft == gquota_group_bsoft|human_to_bytes |
| 64 |
- test_gquota_group_before.bhard == gquota_group_bhard|human_to_bytes |
| 65 |
- test_gquota_group_before.isoft == gquota_group_isoft |
| 66 |
- test_gquota_group_before.ihard == gquota_group_ihard |
| 67 |
- test_gquota_group_before.rtbsoft == gquota_group_rtbsoft|human_to_bytes |
| 68 |
- test_gquota_group_before.rtbhard == gquota_group_rtbhard|human_to_bytes |
| 69 |
- name: Re-apply default group limits |
| 70 |
xfs_quota: |
| 71 |
bsoft: '{{ gquota_default_bsoft }}' |
| 72 |
bhard: '{{ gquota_default_bhard }}' |
| 73 |
isoft: '{{ gquota_default_isoft }}' |
| 74 |
ihard: '{{ gquota_default_ihard }}' |
| 75 |
mountpoint: '{{ remote_tmp_dir }}/gquota' |
| 76 |
rtbsoft: '{{ gquota_default_rtbsoft }}' |
| 77 |
rtbhard: '{{ gquota_default_rtbhard }}' |
| 78 |
type: group |
| 79 |
become: true |
| 80 |
register: test_gquota_default_after |
| 81 |
- name: Assert default group limits results after re-apply |
| 82 |
assert: |
| 83 |
that: |
| 84 |
- not test_gquota_default_after.changed |
| 85 |
- name: Re-apply group limits |
| 86 |
xfs_quota: |
| 87 |
bsoft: '{{ gquota_group_bsoft }}' |
| 88 |
bhard: '{{ gquota_group_bhard }}' |
| 89 |
isoft: '{{ gquota_group_isoft }}' |
| 90 |
ihard: '{{ gquota_group_ihard }}' |
| 91 |
mountpoint: '{{ remote_tmp_dir }}/gquota' |
| 92 |
name: xfsquotauser |
| 93 |
rtbsoft: '{{ gquota_group_rtbsoft }}' |
| 94 |
rtbhard: '{{ gquota_group_rtbhard }}' |
| 95 |
type: group |
| 96 |
become: true |
| 97 |
register: test_gquota_group_after |
| 98 |
- name: Assert group limits results for xfsquotauser after re-apply |
| 99 |
assert: |
| 100 |
that: |
| 101 |
- not test_gquota_group_after.changed |
| 102 |
- name: Reset default group limits |
| 103 |
xfs_quota: |
| 104 |
mountpoint: '{{ remote_tmp_dir }}/gquota' |
| 105 |
state: absent |
| 106 |
type: group |
| 107 |
become: true |
| 108 |
register: test_reset_gquota_default |
| 109 |
- name: Assert reset of default group limits results |
| 110 |
assert: |
| 111 |
that: |
| 112 |
- test_reset_gquota_default.changed |
| 113 |
- test_reset_gquota_default.bsoft == 0 |
| 114 |
- test_reset_gquota_default.bhard == 0 |
| 115 |
- test_reset_gquota_default.isoft == 0 |
| 116 |
- test_reset_gquota_default.ihard == 0 |
| 117 |
- test_reset_gquota_default.rtbsoft == 0 |
| 118 |
- test_reset_gquota_default.rtbhard == 0 |
| 119 |
- name: Reset group limits for xfsquotauser |
| 120 |
xfs_quota: |
| 121 |
mountpoint: '{{ remote_tmp_dir }}/gquota' |
| 122 |
name: xfsquotauser |
| 123 |
state: absent |
| 124 |
type: group |
| 125 |
become: true |
| 126 |
register: test_reset_gquota_group |
| 127 |
- name: Assert reset of default group limits results |
| 128 |
assert: |
| 129 |
that: |
| 130 |
- test_reset_gquota_group.changed |
| 131 |
- test_reset_gquota_group.bsoft == 0 |
| 132 |
- test_reset_gquota_group.bhard == 0 |
| 133 |
- test_reset_gquota_group.isoft == 0 |
| 134 |
- test_reset_gquota_group.ihard == 0 |
| 135 |
- test_reset_gquota_group.rtbsoft == 0 |
| 136 |
- test_reset_gquota_group.rtbhard == 0 |
| 137 |
always: |
| 138 |
- name: Unmount filesystem |
| 139 |
become: true |
| 140 |
ansible.posix.mount: |
| 141 |
fstab: '{{ remote_tmp_dir }}/fstab' |
| 142 |
path: '{{ remote_tmp_dir }}/gquota' |
| 143 |
state: unmounted |
| 144 |
- name: Remove disk image |
| 145 |
file: |
| 146 |
path: '{{ remote_tmp_dir }}/img-gquota' |
| 147 |
state: absent |