mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Initial commit
This commit is contained in:
commit
aebc1b03fd
4861 changed files with 812621 additions and 0 deletions
142
tests/integration/targets/xfs_quota/tasks/gquota.yml
Normal file
142
tests/integration/targets/xfs_quota/tasks/gquota.yml
Normal file
|
@ -0,0 +1,142 @@
|
|||
- name: Create disk image
|
||||
command: 'dd if=/dev/zero of={{ remote_tmp_dir }}/img-gquota bs=1M count=20
|
||||
|
||||
'
|
||||
- name: Create XFS filesystem
|
||||
filesystem:
|
||||
dev: '{{ remote_tmp_dir }}/img-gquota'
|
||||
fstype: xfs
|
||||
- block:
|
||||
- name: Mount filesystem
|
||||
become: true
|
||||
ansible.posix.mount:
|
||||
fstab: '{{ remote_tmp_dir }}/fstab'
|
||||
src: '{{ remote_tmp_dir }}/img-gquota'
|
||||
path: '{{ remote_tmp_dir }}/gquota'
|
||||
fstype: xfs
|
||||
opts: gquota
|
||||
state: mounted
|
||||
- name: Apply default group limits
|
||||
xfs_quota:
|
||||
bsoft: '{{ gquota_default_bsoft }}'
|
||||
bhard: '{{ gquota_default_bhard }}'
|
||||
isoft: '{{ gquota_default_isoft }}'
|
||||
ihard: '{{ gquota_default_ihard }}'
|
||||
mountpoint: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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
|
||||
become: true
|
||||
ansible.posix.mount:
|
||||
fstab: '{{ remote_tmp_dir }}/fstab'
|
||||
path: '{{ remote_tmp_dir }}/gquota'
|
||||
state: unmounted
|
||||
- name: Remove disk image
|
||||
file:
|
||||
path: '{{ remote_tmp_dir }}/img-gquota'
|
||||
state: absent
|
18
tests/integration/targets/xfs_quota/tasks/main.yml
Normal file
18
tests/integration/targets/xfs_quota/tasks/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- block:
|
||||
- name: Create test user
|
||||
user:
|
||||
name: xfsquotauser
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- include_tasks: uquota.yml
|
||||
- include_tasks: gquota.yml
|
||||
- include_tasks: pquota.yml
|
||||
|
||||
always:
|
||||
- name: cleanup test user
|
||||
user:
|
||||
name: xfsquotauser
|
||||
state: absent
|
||||
become: yes
|
179
tests/integration/targets/xfs_quota/tasks/pquota.yml
Normal file
179
tests/integration/targets/xfs_quota/tasks/pquota.yml
Normal file
|
@ -0,0 +1,179 @@
|
|||
- name: Create disk image
|
||||
command: 'dd if=/dev/zero of={{ remote_tmp_dir }}/img-pquota bs=1M count=20
|
||||
|
||||
'
|
||||
- name: Create XFS filesystem
|
||||
filesystem:
|
||||
dev: '{{ remote_tmp_dir }}/img-pquota'
|
||||
fstype: xfs
|
||||
- name: Create xfs related files
|
||||
file:
|
||||
path: /etc/{{ item }}
|
||||
state: touch
|
||||
become: true
|
||||
loop:
|
||||
- projid
|
||||
- projects
|
||||
- name: Add test xfs quota project id
|
||||
lineinfile:
|
||||
path: /etc/projid
|
||||
line: xft_quotaval:99999
|
||||
state: present
|
||||
become: true
|
||||
- name: Add test xfs quota project path
|
||||
lineinfile:
|
||||
path: /etc/projects
|
||||
line: 99999:{{ remote_tmp_dir }}/pquota/test
|
||||
state: present
|
||||
become: true
|
||||
- block:
|
||||
- name: Mount filesystem
|
||||
become: true
|
||||
ansible.posix.mount:
|
||||
fstab: '{{ remote_tmp_dir }}/fstab'
|
||||
src: '{{ remote_tmp_dir }}/img-pquota'
|
||||
path: '{{ remote_tmp_dir }}/pquota'
|
||||
fstype: xfs
|
||||
opts: pquota
|
||||
state: mounted
|
||||
- name: Create test directory
|
||||
file:
|
||||
path: '{{ remote_tmp_dir }}/pquota/test'
|
||||
state: directory
|
||||
become: true
|
||||
- name: Apply default project limits
|
||||
xfs_quota:
|
||||
bsoft: '{{ pquota_default_bsoft }}'
|
||||
bhard: '{{ pquota_default_bhard }}'
|
||||
isoft: '{{ pquota_default_isoft }}'
|
||||
ihard: '{{ pquota_default_ihard }}'
|
||||
mountpoint: '{{ remote_tmp_dir }}/pquota'
|
||||
rtbsoft: '{{ pquota_default_rtbsoft }}'
|
||||
rtbhard: '{{ pquota_default_rtbhard }}'
|
||||
type: project
|
||||
become: true
|
||||
register: test_pquota_default_before
|
||||
- name: Assert default project limits results
|
||||
assert:
|
||||
that:
|
||||
- test_pquota_default_before.changed
|
||||
- test_pquota_default_before.bsoft == pquota_default_bsoft|human_to_bytes
|
||||
- test_pquota_default_before.bhard == pquota_default_bhard|human_to_bytes
|
||||
- test_pquota_default_before.isoft == pquota_default_isoft
|
||||
- test_pquota_default_before.ihard == pquota_default_ihard
|
||||
- test_pquota_default_before.rtbsoft == pquota_default_rtbsoft|human_to_bytes
|
||||
- test_pquota_default_before.rtbhard == pquota_default_rtbhard|human_to_bytes
|
||||
- name: Apply project limits
|
||||
xfs_quota:
|
||||
bsoft: '{{ pquota_project_bsoft }}'
|
||||
bhard: '{{ pquota_project_bhard }}'
|
||||
isoft: '{{ pquota_project_isoft }}'
|
||||
ihard: '{{ pquota_project_ihard }}'
|
||||
mountpoint: '{{ remote_tmp_dir }}/pquota'
|
||||
name: xft_quotaval
|
||||
rtbsoft: '{{ pquota_project_rtbsoft }}'
|
||||
rtbhard: '{{ pquota_project_rtbhard }}'
|
||||
type: project
|
||||
become: true
|
||||
register: test_pquota_project_before
|
||||
- name: Assert project limits results for xft_quotaval
|
||||
assert:
|
||||
that:
|
||||
- test_pquota_project_before.changed
|
||||
- test_pquota_project_before.bsoft == pquota_project_bsoft|human_to_bytes
|
||||
- test_pquota_project_before.bhard == pquota_project_bhard|human_to_bytes
|
||||
- test_pquota_project_before.isoft == pquota_project_isoft
|
||||
- test_pquota_project_before.ihard == pquota_project_ihard
|
||||
- test_pquota_project_before.rtbsoft == pquota_project_rtbsoft|human_to_bytes
|
||||
- test_pquota_project_before.rtbhard == pquota_project_rtbhard|human_to_bytes
|
||||
- name: Re-apply default project limits
|
||||
xfs_quota:
|
||||
bsoft: '{{ pquota_default_bsoft }}'
|
||||
bhard: '{{ pquota_default_bhard }}'
|
||||
isoft: '{{ pquota_default_isoft }}'
|
||||
ihard: '{{ pquota_default_ihard }}'
|
||||
mountpoint: '{{ remote_tmp_dir }}/pquota'
|
||||
rtbsoft: '{{ pquota_default_rtbsoft }}'
|
||||
rtbhard: '{{ pquota_default_rtbhard }}'
|
||||
type: project
|
||||
become: true
|
||||
register: test_pquota_default_after
|
||||
- name: Assert default project limits results after re-apply
|
||||
assert:
|
||||
that:
|
||||
- not test_pquota_default_after.changed
|
||||
- name: Re-apply project limits
|
||||
xfs_quota:
|
||||
bsoft: '{{ pquota_project_bsoft }}'
|
||||
bhard: '{{ pquota_project_bhard }}'
|
||||
isoft: '{{ pquota_project_isoft }}'
|
||||
ihard: '{{ pquota_project_ihard }}'
|
||||
mountpoint: '{{ remote_tmp_dir }}/pquota'
|
||||
name: xft_quotaval
|
||||
rtbsoft: '{{ pquota_project_rtbsoft }}'
|
||||
rtbhard: '{{ pquota_project_rtbhard }}'
|
||||
type: project
|
||||
become: true
|
||||
register: test_pquota_project_after
|
||||
- name: Assert project limits results for xft_quotaval after re-apply
|
||||
assert:
|
||||
that:
|
||||
- not test_pquota_project_after.changed
|
||||
- name: Reset default project limits
|
||||
xfs_quota:
|
||||
mountpoint: '{{ remote_tmp_dir }}/pquota'
|
||||
state: absent
|
||||
type: project
|
||||
become: true
|
||||
register: test_reset_pquota_default
|
||||
- name: Assert reset of default projecy limits results
|
||||
assert:
|
||||
that:
|
||||
- test_reset_pquota_default.changed
|
||||
- test_reset_pquota_default.bsoft == 0
|
||||
- test_reset_pquota_default.bhard == 0
|
||||
- test_reset_pquota_default.isoft == 0
|
||||
- test_reset_pquota_default.ihard == 0
|
||||
- test_reset_pquota_default.rtbsoft == 0
|
||||
- test_reset_pquota_default.rtbhard == 0
|
||||
- name: Reset project limits for xft_quotaval
|
||||
xfs_quota:
|
||||
mountpoint: '{{ remote_tmp_dir }}/pquota'
|
||||
name: xft_quotaval
|
||||
state: absent
|
||||
type: project
|
||||
become: true
|
||||
register: test_reset_pquota_project
|
||||
- name: Assert reset of project limits results for xft_quotaval
|
||||
assert:
|
||||
that:
|
||||
- test_reset_pquota_project.changed
|
||||
- test_reset_pquota_project.bsoft == 0
|
||||
- test_reset_pquota_project.bhard == 0
|
||||
- test_reset_pquota_project.isoft == 0
|
||||
- test_reset_pquota_project.ihard == 0
|
||||
- test_reset_pquota_project.rtbsoft == 0
|
||||
- test_reset_pquota_project.rtbhard == 0
|
||||
always:
|
||||
- name: Unmount filesystem
|
||||
become: true
|
||||
ansible.posix.mount:
|
||||
fstab: '{{ remote_tmp_dir }}/fstab'
|
||||
path: '{{ remote_tmp_dir }}/pquota'
|
||||
state: unmounted
|
||||
- name: Remove disk image
|
||||
file:
|
||||
path: '{{ remote_tmp_dir }}/img-pquota'
|
||||
state: absent
|
||||
- name: Remove xfs quota project id
|
||||
lineinfile:
|
||||
path: /etc/projid
|
||||
regexp: ^xft_quotaval:99999$
|
||||
state: absent
|
||||
become: true
|
||||
- name: Remove xfs quota project path
|
||||
lineinfile:
|
||||
path: /etc/projects
|
||||
regexp: ^99999:.*$
|
||||
state: absent
|
||||
become: true
|
142
tests/integration/targets/xfs_quota/tasks/uquota.yml
Normal file
142
tests/integration/targets/xfs_quota/tasks/uquota.yml
Normal file
|
@ -0,0 +1,142 @@
|
|||
- name: Create disk image
|
||||
command: 'dd if=/dev/zero of={{ remote_tmp_dir }}/img-uquota bs=1M count=20
|
||||
|
||||
'
|
||||
- name: Create XFS filesystem
|
||||
filesystem:
|
||||
dev: '{{ remote_tmp_dir }}/img-uquota'
|
||||
fstype: xfs
|
||||
- block:
|
||||
- name: Mount filesystem
|
||||
become: true
|
||||
ansible.posix.mount:
|
||||
fstab: '{{ remote_tmp_dir }}/fstab'
|
||||
src: '{{ remote_tmp_dir }}/img-uquota'
|
||||
path: '{{ remote_tmp_dir }}/uquota'
|
||||
fstype: xfs
|
||||
opts: uquota
|
||||
state: mounted
|
||||
- name: Apply default user limits
|
||||
xfs_quota:
|
||||
bsoft: '{{ uquota_default_bsoft }}'
|
||||
bhard: '{{ uquota_default_bhard }}'
|
||||
isoft: '{{ uquota_default_isoft }}'
|
||||
ihard: '{{ uquota_default_ihard }}'
|
||||
mountpoint: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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: '{{ remote_tmp_dir }}/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
|
||||
become: true
|
||||
ansible.posix.mount:
|
||||
fstab: '{{ remote_tmp_dir }}/fstab'
|
||||
path: '{{ remote_tmp_dir }}/uquota'
|
||||
state: unmounted
|
||||
- name: Remove disk image
|
||||
file:
|
||||
path: '{{ remote_tmp_dir }}/img-uquota'
|
||||
state: absent
|
Loading…
Add table
Add a link
Reference in a new issue