Skip to content

Commit

Permalink
More truthy booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
buluma committed Mar 26, 2024
1 parent 1bcccda commit f6cf8b2
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ jobs:
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test_role:
needs:
- lint
- test
runs-on: ubuntu-20.04

steps:
- uses: "actions/checkout@master"
- name: Test Role
run: "ansible-galaxy role import --api-key {{ secrets.galaxy_api_key }} buluma ${{ github.repository }}"
# test_role:
# needs:
# - lint
# - test
# runs-on: ubuntu-20.04
#
# steps:
# - uses: "actions/checkout@master"
# - name: Test Role
# run: "ansible-galaxy role import --api-key {{ secrets.galaxy_api_key }} buluma {{ role_name }}"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- repo: https://github.com/buluma/pre-commit
rev: v1.0.3
hooks:
- id: ansible_role_find_unused_variable
# - id: ansible_role_find_unused_variable
- id: ansible_role_find_empty_files
- id: ansible_role_find_empty_directories
- id: ansible_role_find_undefined_handlers
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

roles:
- role: buluma.mount
Expand All @@ -33,8 +33,8 @@ The machine needs to be prepared. In CI this is done using [`molecule/default/pr
---
- name: Prepare
hosts: all
become: yes
gather_facts: no
become: true
gather_facts: false
roles:
- role: buluma.bootstrap
Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- name: Run swapon
ansible.builtin.command:
cmd: swapon -a
changed_when: yes
changed_when: true
when:
- mount_requests | regex_search("swap")
4 changes: 2 additions & 2 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

roles:
- role: ansible-role-mount
Expand Down
4 changes: 2 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Prepare
hosts: all
become: yes
gather_facts: no
become: true
gather_facts: false

roles:
- role: buluma.bootstrap
4 changes: 2 additions & 2 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Verify
hosts: all
become: yes
gather_facts: no
become: true
gather_facts: false

tasks:
- name: Check directory
Expand Down
18 changes: 9 additions & 9 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
that:
- mount_default_mode is defined
- mount_default_mode is string
quiet: yes
quiet: true

- name: assert | Test if mount_default_owner is set correctly
ansible.builtin.assert:
that:
- mount_default_owner is defined
- mount_default_owner is string
quiet: yes
quiet: true

- name: assert | Test if mount_default_group is set correctly
ansible.builtin.assert:
that:
- mount_default_group is defined
- mount_default_group is string
quiet: yes
quiet: true

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

- name: assert | Test if item.backup in mount_requests is set correctly
ansible.builtin.assert:
that:
- item.backup is boolean
quiet: yes
quiet: true
loop: "{{ mount_requests }}"
loop_control:
label: "{{ item.path }}"
Expand All @@ -45,7 +45,7 @@
ansible.builtin.assert:
that:
- item.boot is boolean
quiet: yes
quiet: true
loop: "{{ mount_requests }}"
loop_control:
label: "{{ item.path }}"
Expand All @@ -59,7 +59,7 @@
that:
- item.fstype is string
- item.fstype in [ "cifs", "ext3", "ext4", "iso9660", "nfs", "none", "swap", "xfs" ]
quiet: yes
quiet: true
loop: "{{ mount_requests }}"
loop_control:
label: "{{ item.path }}"
Expand All @@ -75,7 +75,7 @@
that:
- item.path is defined
- item.path is string
quiet: yes
quiet: true
loop: "{{ mount_requests }}"
loop_control:
label: "{{ item.path }}"
Expand All @@ -85,7 +85,7 @@
that:
- item.state is string
- item.state in [ "absent", "mounted", "present", "remounted", "unmounted" ]
quiet: yes
quiet: true
when:
- item.state is defined
loop: "{{ mount_requests }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- name: Import assert.yml
ansible.builtin.import_tasks: assert.yml
run_once: yes
run_once: true
delegate_to: localhost

- name: Process mount_requests
Expand Down

0 comments on commit f6cf8b2

Please sign in to comment.