You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/xfs_quota/tasks/uquota.yml

159 lines
5.5 KiB
YAML

New module: xfs_quota (#51654) * New module: xfs_quota * wildcard import resolution * pep8 fixes * validate-modules fixes * pep8 and validate-module fixes * removal of extra copyright info * description capitalization and trailing dot * Some more description * type specification * removal of notes * reorder imports * sorting * starting with variable type * removal of defaults * results to dict * results to dict * complete condition * removal of spaces for pep8 compliancy, removal of root check, addition of tests for failed xfs_quota commands indicating the need for elevation/capabilities * lost result * typo * historical override removal * report back values * unexpected spaces removal * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * typo * raw data, full data * removal of several else: statements and indentation * pep8 * typo * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * typo * use bytes as base, not kilobytes * be consistent * integration tests * lint * empty lines * Update lib/ansible/modules/system/xfs_quota.py Co-Authored-By: bushvin <bushvin@users.noreply.github.com> * updates * ci group * XFS not supported on osx * XFS not supported by freebsd * long lines and removal of xfs_quota dict in return * RETURN values * no more xfs_quota dict
6 years ago
---
- name: 'Create disk image'
command: >
dd if=/dev/zero of={{ ansible_user_dir }}/ansible_testing/img-uquota bs=1M count=20
- name: 'Create XFS filesystem'
filesystem:
dev: '{{ ansible_user_dir }}/ansible_testing/img-uquota'
fstype: xfs
- block:
- name: 'Mount filesystem'
mount:
fstab: '{{ ansible_user_dir }}/ansible_testing/fstab'
src: '{{ ansible_user_dir }}/ansible_testing/img-uquota'
path: '{{ ansible_user_dir }}/ansible_testing/uquota'
fstype: xfs
opts: uquota
state: mounted
become: True
- name: 'Apply default user limits'
xfs_quota:
bsoft: '{{ uquota_default_bsoft }}'
bhard: '{{ uquota_default_bhard }}'
isoft: '{{ uquota_default_isoft }}'
ihard: '{{ uquota_default_ihard }}'
mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota'
rtbsoft: '{{ uquota_default_rtbsoft }}'
rtbhard: '{{ uquota_default_rtbhard }}'
type: user
become: True
register: test_uquota_default_before
- name: Assert default user limits results
assert:
that:
- test_uquota_default_before.changed
- test_uquota_default_before.bsoft == uquota_default_bsoft|human_to_bytes
- test_uquota_default_before.bhard == uquota_default_bhard|human_to_bytes
- test_uquota_default_before.isoft == uquota_default_isoft
- test_uquota_default_before.ihard == uquota_default_ihard
- test_uquota_default_before.rtbsoft == uquota_default_rtbsoft|human_to_bytes
- test_uquota_default_before.rtbhard == uquota_default_rtbhard|human_to_bytes
- name: 'Apply user limits'
xfs_quota:
bsoft: '{{ uquota_user_bsoft }}'
bhard: '{{ uquota_user_bhard }}'
isoft: '{{ uquota_user_isoft }}'
ihard: '{{ uquota_user_ihard }}'
mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota'
name: xfsquotauser
rtbsoft: '{{ uquota_user_rtbsoft }}'
rtbhard: '{{ uquota_user_rtbhard }}'
type: user
become: True
register: test_uquota_user_before
- name: Assert user limits results
assert:
that:
- test_uquota_user_before.changed
- test_uquota_user_before.bsoft == uquota_user_bsoft|human_to_bytes
- test_uquota_user_before.bhard == uquota_user_bhard|human_to_bytes
- test_uquota_user_before.isoft == uquota_user_isoft
- test_uquota_user_before.ihard == uquota_user_ihard
- test_uquota_user_before.rtbsoft == uquota_user_rtbsoft|human_to_bytes
- test_uquota_user_before.rtbhard == uquota_user_rtbhard|human_to_bytes
- name: 'Re-apply default user limits'
xfs_quota:
bsoft: '{{ uquota_default_bsoft }}'
bhard: '{{ uquota_default_bhard }}'
isoft: '{{ uquota_default_isoft }}'
ihard: '{{ uquota_default_ihard }}'
mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota'
rtbsoft: '{{ uquota_default_rtbsoft }}'
rtbhard: '{{ uquota_default_rtbhard }}'
type: user
become: True
register: test_uquota_default_after
- name: Assert default user limits results after re-apply
assert:
that:
- not test_uquota_default_after.changed
- name: 'Re-apply user limits'
xfs_quota:
bsoft: '{{ uquota_user_bsoft }}'
bhard: '{{ uquota_user_bhard }}'
isoft: '{{ uquota_user_isoft }}'
ihard: '{{ uquota_user_ihard }}'
mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota'
name: xfsquotauser
rtbsoft: '{{ uquota_user_rtbsoft }}'
rtbhard: '{{ uquota_user_rtbhard }}'
type: user
become: True
register: test_uquota_user_after
- name: Assert user limits results for xfsquotauser after re-apply
assert:
that:
- not test_uquota_user_after.changed
- name: 'Reset default user limits'
xfs_quota:
mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota'
state: absent
type: user
become: True
register: test_reset_uquota_default
- name: Assert reset of default user limits results
assert:
that:
- test_reset_uquota_default.changed
- test_reset_uquota_default.bsoft == 0
- test_reset_uquota_default.bhard == 0
- test_reset_uquota_default.isoft == 0
- test_reset_uquota_default.ihard == 0
- test_reset_uquota_default.rtbsoft == 0
- test_reset_uquota_default.rtbhard == 0
- name: 'Reset user limits for xfsquotauser'
xfs_quota:
mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota'
name: xfsquotauser
state: absent
type: user
become: True
register: test_reset_uquota_user
- name: Assert reset of default user limits results
assert:
that:
- test_reset_uquota_user.changed
- test_reset_uquota_user.bsoft == 0
- test_reset_uquota_user.bhard == 0
- test_reset_uquota_user.isoft == 0
- test_reset_uquota_user.ihard == 0
- test_reset_uquota_user.rtbsoft == 0
- test_reset_uquota_user.rtbhard == 0
always:
- name: 'Unmount filesystem'
mount:
fstab: '{{ ansible_user_dir }}/ansible_testing/fstab'
path: '{{ ansible_user_dir }}/ansible_testing/uquota'
state: unmounted
become: True
- name: Remove disk image
file:
path: '{{ ansible_user_dir }}/ansible_testing/img-uquota'
state: absent