mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
159 lines
5.6 KiB
YAML
159 lines
5.6 KiB
YAML
|
---
|
||
|
- name: 'Create disk image'
|
||
|
command: >
|
||
|
dd if=/dev/zero of={{ ansible_user_dir }}/ansible_testing/img-gquota bs=1M count=20
|
||
|
|
||
|
- name: 'Create XFS filesystem'
|
||
|
filesystem:
|
||
|
dev: '{{ ansible_user_dir }}/ansible_testing/img-gquota'
|
||
|
fstype: xfs
|
||
|
|
||
|
- block:
|
||
|
- name: 'Mount filesystem'
|
||
|
mount:
|
||
|
fstab: '{{ ansible_user_dir }}/ansible_testing/fstab'
|
||
|
src: '{{ ansible_user_dir }}/ansible_testing/img-gquota'
|
||
|
path: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
fstype: xfs
|
||
|
opts: gquota
|
||
|
state: mounted
|
||
|
become: True
|
||
|
|
||
|
- name: 'Apply default group limits'
|
||
|
xfs_quota:
|
||
|
bsoft: '{{ gquota_default_bsoft }}'
|
||
|
bhard: '{{ gquota_default_bhard }}'
|
||
|
isoft: '{{ gquota_default_isoft }}'
|
||
|
ihard: '{{ gquota_default_ihard }}'
|
||
|
mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
rtbsoft: '{{ gquota_default_rtbsoft }}'
|
||
|
rtbhard: '{{ gquota_default_rtbhard }}'
|
||
|
type: group
|
||
|
become: True
|
||
|
register: test_gquota_default_before
|
||
|
|
||
|
- name: Assert default group limits results
|
||
|
assert:
|
||
|
that:
|
||
|
- test_gquota_default_before.changed
|
||
|
- test_gquota_default_before.bsoft == gquota_default_bsoft|human_to_bytes
|
||
|
- test_gquota_default_before.bhard == gquota_default_bhard|human_to_bytes
|
||
|
- test_gquota_default_before.isoft == gquota_default_isoft
|
||
|
- test_gquota_default_before.ihard == gquota_default_ihard
|
||
|
- test_gquota_default_before.rtbsoft == gquota_default_rtbsoft|human_to_bytes
|
||
|
- test_gquota_default_before.rtbhard == gquota_default_rtbhard|human_to_bytes
|
||
|
|
||
|
- name: 'Apply group limits'
|
||
|
xfs_quota:
|
||
|
bsoft: '{{ gquota_group_bsoft }}'
|
||
|
bhard: '{{ gquota_group_bhard }}'
|
||
|
isoft: '{{ gquota_group_isoft }}'
|
||
|
ihard: '{{ gquota_group_ihard }}'
|
||
|
mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
name: xfsquotauser
|
||
|
rtbsoft: '{{ gquota_group_rtbsoft }}'
|
||
|
rtbhard: '{{ gquota_group_rtbhard }}'
|
||
|
type: group
|
||
|
become: True
|
||
|
register: test_gquota_group_before
|
||
|
|
||
|
- name: Assert group limits results for xfsquotauser
|
||
|
assert:
|
||
|
that:
|
||
|
- test_gquota_group_before.changed
|
||
|
- test_gquota_group_before.bsoft == gquota_group_bsoft|human_to_bytes
|
||
|
- test_gquota_group_before.bhard == gquota_group_bhard|human_to_bytes
|
||
|
- test_gquota_group_before.isoft == gquota_group_isoft
|
||
|
- test_gquota_group_before.ihard == gquota_group_ihard
|
||
|
- test_gquota_group_before.rtbsoft == gquota_group_rtbsoft|human_to_bytes
|
||
|
- test_gquota_group_before.rtbhard == gquota_group_rtbhard|human_to_bytes
|
||
|
|
||
|
- name: 'Re-apply default group limits'
|
||
|
xfs_quota:
|
||
|
bsoft: '{{ gquota_default_bsoft }}'
|
||
|
bhard: '{{ gquota_default_bhard }}'
|
||
|
isoft: '{{ gquota_default_isoft }}'
|
||
|
ihard: '{{ gquota_default_ihard }}'
|
||
|
mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
rtbsoft: '{{ gquota_default_rtbsoft }}'
|
||
|
rtbhard: '{{ gquota_default_rtbhard }}'
|
||
|
type: group
|
||
|
become: True
|
||
|
register: test_gquota_default_after
|
||
|
|
||
|
- name: Assert default group limits results after re-apply
|
||
|
assert:
|
||
|
that:
|
||
|
- not test_gquota_default_after.changed
|
||
|
|
||
|
- name: 'Re-apply group limits'
|
||
|
xfs_quota:
|
||
|
bsoft: '{{ gquota_group_bsoft }}'
|
||
|
bhard: '{{ gquota_group_bhard }}'
|
||
|
isoft: '{{ gquota_group_isoft }}'
|
||
|
ihard: '{{ gquota_group_ihard }}'
|
||
|
mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
name: xfsquotauser
|
||
|
rtbsoft: '{{ gquota_group_rtbsoft }}'
|
||
|
rtbhard: '{{ gquota_group_rtbhard }}'
|
||
|
type: group
|
||
|
become: True
|
||
|
register: test_gquota_group_after
|
||
|
|
||
|
- name: Assert group limits results for xfsquotauser after re-apply
|
||
|
assert:
|
||
|
that:
|
||
|
- not test_gquota_group_after.changed
|
||
|
|
||
|
- name: 'Reset default group limits'
|
||
|
xfs_quota:
|
||
|
mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
state: absent
|
||
|
type: group
|
||
|
become: True
|
||
|
register: test_reset_gquota_default
|
||
|
|
||
|
- name: Assert reset of default group limits results
|
||
|
assert:
|
||
|
that:
|
||
|
- test_reset_gquota_default.changed
|
||
|
- test_reset_gquota_default.bsoft == 0
|
||
|
- test_reset_gquota_default.bhard == 0
|
||
|
- test_reset_gquota_default.isoft == 0
|
||
|
- test_reset_gquota_default.ihard == 0
|
||
|
- test_reset_gquota_default.rtbsoft == 0
|
||
|
- test_reset_gquota_default.rtbhard == 0
|
||
|
|
||
|
- name: 'Reset group limits for xfsquotauser'
|
||
|
xfs_quota:
|
||
|
mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
name: xfsquotauser
|
||
|
state: absent
|
||
|
type: group
|
||
|
become: True
|
||
|
register: test_reset_gquota_group
|
||
|
|
||
|
- name: Assert reset of default group limits results
|
||
|
assert:
|
||
|
that:
|
||
|
- test_reset_gquota_group.changed
|
||
|
- test_reset_gquota_group.bsoft == 0
|
||
|
- test_reset_gquota_group.bhard == 0
|
||
|
- test_reset_gquota_group.isoft == 0
|
||
|
- test_reset_gquota_group.ihard == 0
|
||
|
- test_reset_gquota_group.rtbsoft == 0
|
||
|
- test_reset_gquota_group.rtbhard == 0
|
||
|
|
||
|
always:
|
||
|
- name: 'Unmount filesystem'
|
||
|
mount:
|
||
|
fstab: '{{ ansible_user_dir }}/ansible_testing/fstab'
|
||
|
path: '{{ ansible_user_dir }}/ansible_testing/gquota'
|
||
|
state: unmounted
|
||
|
become: True
|
||
|
|
||
|
- name: Remove disk image
|
||
|
file:
|
||
|
path: '{{ ansible_user_dir }}/ansible_testing/img-gquota'
|
||
|
state: absent
|