Skip to content

Commit

Permalink
Add filename to taskname, cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed May 22, 2023
1 parent e349840 commit 46b7d02
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ exclude_paths:

skip_list:
- yaml[truthy]

enable_list:
- name[prefix]
52 changes: 26 additions & 26 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---

- name: Test if storage_default_fstype is set correctly
- name: assert | Test if storage_default_fstype is set correctly
ansible.builtin.assert:
that:
- storage_default_fstype is defined
- storage_default_fstype is string
- storage_default_fstype in [ "btrfs", "cramfs", "ext2", "ext3", "ext4", "fat", "msdos", "ntfs", "vfat", "xfs" ]
quiet: yes

- name: Test if storage_partitions is set correctly
- name: assert | Test if storage_partitions is set correctly
ansible.builtin.assert:
that:
- storage_partitions is iterable
quiet: yes
when:
- storage_partitions is defined

- name: Test if storage_partitions.name is set correctly
- name: assert | Test if storage_partitions.name is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -28,7 +28,7 @@
when:
- storage_partitions is defined

- name: Test if storage_partitions.number is set correctly
- name: assert | Test if storage_partitions.number is set correctly
ansible.builtin.assert:
that:
- item.number is defined
Expand All @@ -41,7 +41,7 @@
when:
- storage_partitions is defined

- name: Test if storage_partitions.part_end is set correctly
- name: assert | Test if storage_partitions.part_end is set correctly
ansible.builtin.assert:
that:
- item.part_end is defined
Expand All @@ -53,15 +53,15 @@
when:
- storage_partitions is defined

- name: Test if storage_volumegroups is set correctly
- name: assert | Test if storage_volumegroups is set correctly
ansible.builtin.assert:
that:
- storage_volumegroups is iterable
quiet: yes
when:
- storage_volumegroups is defined

- name: Test if storage_volumegroups.name is set correctly
- name: assert | Test if storage_volumegroups.name is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -73,7 +73,7 @@
when:
- storage_volumegroups is defined

- name: Test if storage_volumegroups.devices is set correctly
- name: assert | Test if storage_volumegroups.devices is set correctly
ansible.builtin.assert:
that:
- item.devices is defined
Expand All @@ -85,7 +85,7 @@
when:
- storage_volumegroups is defined

- name: Test if storage_volumegroups.size is set correctly
- name: assert | Test if storage_volumegroups.size is set correctly
ansible.builtin.assert:
that:
- item.size is number
Expand All @@ -98,15 +98,15 @@
- storage_volumegroups is defined
- item.size is defined

- name: Test if storage_volumes is set correctly
- name: assert | Test if storage_volumes is set correctly
ansible.builtin.assert:
that:
- storage_volumes is iterable
quiet: yes
when:
- storage_volumes is defined

- name: Test if storage_volumes.name is set correctly
- name: assert | Test if storage_volumes.name is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -118,7 +118,7 @@
when:
- storage_volumes is defined

- name: Test if storage_volumes.vg is set correctly
- name: assert | Test if storage_volumes.vg is set correctly
ansible.builtin.assert:
that:
- item.vg is defined
Expand All @@ -130,7 +130,7 @@
when:
- storage_volumes is defined

- name: Test if storage_volumes.size is set correctly
- name: assert | Test if storage_volumes.size is set correctly
ansible.builtin.assert:
that:
- item.size is defined
Expand All @@ -142,15 +142,15 @@
when:
- storage_volumes is defined

- name: Test if storage_filesystems is set correctly
- name: assert | Test if storage_filesystems is set correctly
ansible.builtin.assert:
that:
- storage_filesystems is iterable
quiet: yes
when:
- storage_filesystems is defined

- name: Test if storage_filesystems.name is set correctly
- name: assert | Test if storage_filesystems.name is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -162,7 +162,7 @@
when:
- storage_filesystems is defined

- name: Test if storage_filesystems.filesystem is set correctly
- name: assert | Test if storage_filesystems.filesystem is set correctly
ansible.builtin.assert:
that:
- item.filesystem is defined
Expand All @@ -175,15 +175,15 @@
when:
- storage_filesystems is defined

- name: Test if storage_mounts is set correctly
- name: assert | Test if storage_mounts is set correctly
ansible.builtin.assert:
that:
- storage_mounts is iterable
quiet: yes
when:
- storage_mounts is defined

- name: Test if storage_mounts.name is set correctly
- name: assert | Test if storage_mounts.name is set correctly
ansible.builtin.assert:
that:
- item.name is defined
Expand All @@ -195,7 +195,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.src is set correctly
- name: assert | Test if storage_mounts.src is set correctly
ansible.builtin.assert:
that:
- item.src is defined
Expand All @@ -207,7 +207,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.owner is set correctly
- name: assert | Test if storage_mounts.owner is set correctly
ansible.builtin.assert:
that:
- item.owner is defined
Expand All @@ -219,7 +219,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.group is set correctly
- name: assert | Test if storage_mounts.group is set correctly
ansible.builtin.assert:
that:
- item.group is defined
Expand All @@ -231,7 +231,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.mode is set correctly
- name: assert | Test if storage_mounts.mode is set correctly
ansible.builtin.assert:
that:
- item.mode is defined
Expand All @@ -243,7 +243,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.opts is set correctly
- name: assert | Test if storage_mounts.opts is set correctly
ansible.builtin.assert:
that:
- item.opts is defined
Expand All @@ -255,7 +255,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.boot is set correctly
- name: assert | Test if storage_mounts.boot is set correctly
ansible.builtin.assert:
that:
- item.boot is defined
Expand All @@ -267,7 +267,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.dump is set correctly
- name: assert | Test if storage_mounts.dump is set correctly
ansible.builtin.assert:
that:
- item.dump is defined
Expand All @@ -280,7 +280,7 @@
when:
- storage_mounts is defined

- name: Test if storage_mounts.passno is set correctly
- name: assert | Test if storage_mounts.passno is set correctly
ansible.builtin.assert:
that:
- item.passno is defined
Expand Down
5 changes: 3 additions & 2 deletions tasks/filesystem.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
- name: Test storage_filesystems

- name: filesystem | Test storage_filesystems
ansible.builtin.assert:
that:
- filesystem.name is defined
quiet: yes

- name: Create filesystems
- name: filesystem | Create filesystems
community.general.filesystem:
dev: "{{ filesystem.name }}"
fstype: "{{ filesystem.fstype | default(storage_default_fstype) }}"
7 changes: 4 additions & 3 deletions tasks/mount.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
- name: Test storage_mounts

- name: mount | Test storage_mounts
ansible.builtin.assert:
that:
- mount.name is defined
- mount.src is defined
quiet: yes

- name: Create mountpoint
- name: mount | Create mountpoint
ansible.builtin.file:
path: "{{ mount.name }}"
owner: "{{ mount.owner | default(omit) }}"
group: "{{ mount.group | default(omit) }}"
mode: "{{ mount.mode | default(omit) }}"
state: directory

- name: Mount filesystems
- name: mount | Mount filesystems
ansible.posix.mount:
path: "{{ mount.name }}"
src: "{{ mount.src }}"
Expand Down
5 changes: 3 additions & 2 deletions tasks/partition.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- name: Test storage_partitions

- name: partition | Test storage_partitions
ansible.builtin.assert:
that:
- partition.name is defined
Expand All @@ -8,7 +9,7 @@
partition.part_end is defined
quiet: yes

- name: Create partitions
- name: partition | Create partitions
community.general.parted:
device: "{{ partition.name }}"
number: "{{ partition.number }}"
Expand Down
5 changes: 3 additions & 2 deletions tasks/volume.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
- name: Test volume

- name: volume | Test volume
ansible.builtin.assert:
that:
- volume.name is defined
- volume.vg is defined
- volume.size is defined
quiet: yes

- name: Create logical volume
- name: volume | Create logical volume
community.general.lvol:
lv: "{{ volume.name }}"
vg: "{{ volume.vg }}"
Expand Down
5 changes: 3 additions & 2 deletions tasks/volumegroup.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
- name: Test volumegroup

- name: volumegroup | Test volumegroup
ansible.builtin.assert:
that:
- volumegroup.name is defined
- volumegroup.devices is defined
quiet: yes

- name: Create volume groups
- name: volumegroup | Create volume groups
community.general.lvg:
vg: "{{ volumegroup.name }}"
pvs: "{{ volumegroup.devices | join(', ') }}"
Expand Down

0 comments on commit 46b7d02

Please sign in to comment.