Adjust YAML files (#10233)

Adjust YAML files.
This commit is contained in:
Felix Fontein 2025-06-15 09:13:16 +02:00 committed by GitHub
parent bc99432f89
commit eaa5e07b28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
247 changed files with 7318 additions and 7375 deletions

View file

@ -50,11 +50,11 @@ jobs:
parameters: parameters:
jobs: jobs:
- ${{ if eq(length(parameters.groups), 0) }}: - ${{ if eq(length(parameters.groups), 0) }}:
- ${{ each target in parameters.targets }}:
- name: ${{ format(parameters.nameFormat, coalesce(target.name, target.test)) }}
test: ${{ format(parameters.testFormat, coalesce(target.test, target.name)) }}
- ${{ if not(eq(length(parameters.groups), 0)) }}:
- ${{ each group in parameters.groups }}:
- ${{ each target in parameters.targets }}: - ${{ each target in parameters.targets }}:
- name: ${{ format(format(parameters.nameGroupFormat, parameters.nameFormat), coalesce(target.name, target.test), group) }} - name: ${{ format(parameters.nameFormat, coalesce(target.name, target.test)) }}
test: ${{ format(format(parameters.testGroupFormat, parameters.testFormat), coalesce(target.test, target.name), group) }} test: ${{ format(parameters.testFormat, coalesce(target.test, target.name)) }}
- ${{ if not(eq(length(parameters.groups), 0)) }}:
- ${{ each group in parameters.groups }}:
- ${{ each target in parameters.targets }}:
- name: ${{ format(format(parameters.nameGroupFormat, parameters.nameFormat), coalesce(target.name, target.test), group) }}
test: ${{ format(format(parameters.testGroupFormat, parameters.testFormat), coalesce(target.test, target.name), group) }}

View file

@ -14,37 +14,37 @@ parameters:
jobs: jobs:
- ${{ each job in parameters.jobs }}: - ${{ each job in parameters.jobs }}:
- job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }} - job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
displayName: ${{ job.name }} displayName: ${{ job.name }}
container: default container: default
workspace: workspace:
clean: all clean: all
steps: steps:
- checkout: self - checkout: self
fetchDepth: $(fetchDepth) fetchDepth: $(fetchDepth)
path: $(checkoutPath) path: $(checkoutPath)
- bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)" - bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)"
displayName: Run Tests displayName: Run Tests
- bash: .azure-pipelines/scripts/process-results.sh - bash: .azure-pipelines/scripts/process-results.sh
condition: succeededOrFailed() condition: succeededOrFailed()
displayName: Process Results displayName: Process Results
- bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)" - bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
condition: eq(variables.haveCoverageData, 'true') condition: eq(variables.haveCoverageData, 'true')
displayName: Aggregate Coverage Data displayName: Aggregate Coverage Data
- task: PublishTestResults@2 - task: PublishTestResults@2
condition: eq(variables.haveTestResults, 'true') condition: eq(variables.haveTestResults, 'true')
inputs: inputs:
testResultsFiles: "$(outputPath)/junit/*.xml" testResultsFiles: "$(outputPath)/junit/*.xml"
displayName: Publish Test Results displayName: Publish Test Results
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
condition: eq(variables.haveBotResults, 'true') condition: eq(variables.haveBotResults, 'true')
displayName: Publish Bot Results displayName: Publish Bot Results
inputs: inputs:
targetPath: "$(outputPath)/bot/" targetPath: "$(outputPath)/bot/"
artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)" artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
condition: eq(variables.haveCoverageData, 'true') condition: eq(variables.haveCoverageData, 'true')
displayName: Publish Coverage Data displayName: Publish Coverage Data
inputs: inputs:
targetPath: "$(Agent.TempDirectory)/coverage/" targetPath: "$(Agent.TempDirectory)/coverage/"
artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)" artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"

View file

@ -7,7 +7,7 @@
# https://github.com/marketplace/actions/ansible-test # https://github.com/marketplace/actions/ansible-test
name: EOL CI name: EOL CI
on: "on":
# Run EOL CI against all pushes (direct commits, also merged PRs), Pull Requests # Run EOL CI against all pushes (direct commits, also merged PRs), Pull Requests
push: push:
branches: branches:

View file

@ -5,7 +5,7 @@
name: "Code scanning - action" name: "Code scanning - action"
on: "on":
schedule: schedule:
- cron: '26 19 * * 1' - cron: '26 19 * * 1'
workflow_dispatch: workflow_dispatch:

View file

@ -4,6 +4,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
collections: collections:
- ansible.posix - ansible.posix
- community.crypto - community.crypto
- community.docker - community.docker

View file

@ -28,10 +28,10 @@
# It requires a host (nfshost) exporting the NFS # It requires a host (nfshost) exporting the NFS
- name: Creating NFS filesystem from nfshost (Linux NFS server) - name: Creating NFS filesystem from nfshost (Linux NFS server)
aix_filesystem: aix_filesystem:
device: /home/ftp device: /home/ftp
nfs_server: nfshost nfs_server: nfshost
filesystem: /nfs/ftp filesystem: /nfs/ftp
state: present state: present
# It requires a volume group named datavg (next three actions) # It requires a volume group named datavg (next three actions)
- name: Creating a logical volume testlv (aix_lvol module) - name: Creating a logical volume testlv (aix_lvol module)

View file

@ -9,60 +9,60 @@
- name: 'setup: create a dummy alternative' - name: 'setup: create a dummy alternative'
block: block:
- import_tasks: setup.yml - import_tasks: setup.yml
############## ##############
# Test parameters: # Test parameters:
# link parameter present / absent ('with_link' variable) # link parameter present / absent ('with_link' variable)
# with / without alternatives defined in alternatives file ('with_alternatives' variable) # with / without alternatives defined in alternatives file ('with_alternatives' variable)
# auto / manual ('mode' variable) # auto / manual ('mode' variable)
- include_tasks: tests.yml - include_tasks: tests.yml
with_nested: with_nested:
- [ true, false ] # with_link - [true, false] # with_link
- [ true, false ] # with_alternatives - [true, false] # with_alternatives
- [ 'auto', 'manual' ] # mode - ['auto', 'manual'] # mode
loop_control: loop_control:
loop_var: test_conf loop_var: test_conf
########## ##########
# Priority # Priority
- block: - block:
- include_tasks: remove_links.yml - include_tasks: remove_links.yml
- include_tasks: setup_test.yml - include_tasks: setup_test.yml
# at least two iterations again # at least two iterations again
- include_tasks: tests_set_priority.yml - include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4 with_sequence: start=3 end=4
vars: vars:
with_alternatives: true with_alternatives: true
mode: auto mode: auto
- block: - block:
- include_tasks: remove_links.yml - include_tasks: remove_links.yml
- include_tasks: setup_test.yml - include_tasks: setup_test.yml
# at least two iterations again # at least two iterations again
- include_tasks: tests_set_priority.yml - include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4 with_sequence: start=3 end=4
vars: vars:
with_alternatives: false with_alternatives: false
mode: auto mode: auto
# Test that path is checked: alternatives must fail when path is nonexistent # Test that path is checked: alternatives must fail when path is nonexistent
- import_tasks: path_is_checked.yml - import_tasks: path_is_checked.yml
# Test that subcommands commands work # Test that subcommands commands work
- import_tasks: subcommands.yml - import_tasks: subcommands.yml
# Test operation of the 'state' parameter # Test operation of the 'state' parameter
- block: - block:
- include_tasks: remove_links.yml - include_tasks: remove_links.yml
- include_tasks: tests_state.yml - include_tasks: tests_state.yml
# Test for the family parameter # Test for the family parameter
- block: - block:
- include_tasks: remove_links.yml - include_tasks: remove_links.yml
- include_tasks: tests_family.yml - include_tasks: tests_family.yml
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
# Cleanup # Cleanup
always: always:

View file

@ -5,11 +5,11 @@
- include_vars: '{{ item }}' - include_vars: '{{ item }}'
with_first_found: with_first_found:
- files: - files:
- '{{ ansible_os_family }}-{{ ansible_distribution_version }}.yml' - '{{ ansible_os_family }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}.yml' - '{{ ansible_os_family }}.yml'
- default.yml - default.yml
paths: ../vars paths: ../vars
- template: - template:
src: dummy_command src: dummy_command
dest: /usr/bin/dummy{{ item }} dest: /usr/bin/dummy{{ item }}

View file

@ -7,32 +7,32 @@
msg: ' with_alternatives: {{ with_alternatives }}, mode: {{ mode }}' msg: ' with_alternatives: {{ with_alternatives }}, mode: {{ mode }}'
- block: - block:
- name: set alternative (using link parameter) - name: set alternative (using link parameter)
alternatives: alternatives:
name: dummy name: dummy
path: '/usr/bin/dummy{{ item }}' path: '/usr/bin/dummy{{ item }}'
link: '/usr/bin/dummy' link: '/usr/bin/dummy'
register: alternative register: alternative
- name: check expected command was executed - name: check expected command was executed
assert: assert:
that: that:
- 'alternative is successful' - 'alternative is successful'
- 'alternative is changed' - 'alternative is changed'
when: with_link when: with_link
- block: - block:
- name: set alternative (without link parameter) - name: set alternative (without link parameter)
alternatives: alternatives:
name: dummy name: dummy
path: '/usr/bin/dummy{{ item }}' path: '/usr/bin/dummy{{ item }}'
register: alternative register: alternative
- name: check expected command was executed - name: check expected command was executed
assert: assert:
that: that:
- 'alternative is successful' - 'alternative is successful'
- 'alternative is changed' - 'alternative is changed'
when: not with_link when: not with_link
- name: execute dummy command - name: execute dummy command

View file

@ -4,13 +4,13 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
- block: - block:
- include_tasks: remove_links.yml - include_tasks: remove_links.yml
- include_tasks: setup_test.yml - include_tasks: setup_test.yml
# at least two iterations: # at least two iterations:
# - first will use 'link currently absent', # - first will use 'link currently absent',
# - second will receive 'link currently points to' # - second will receive 'link currently points to'
- include_tasks: test.yml - include_tasks: test.yml
with_sequence: start=1 end=2 with_sequence: start=1 end=2
vars: vars:
with_link: '{{ test_conf[0] }}' with_link: '{{ test_conf[0] }}'
with_alternatives: '{{ test_conf[1] }}' with_alternatives: '{{ test_conf[1] }}'

View file

@ -11,21 +11,21 @@
# java >= 17 is not available in RHEL and CentOS7 repos, which is required for sdkmanager to run # java >= 17 is not available in RHEL and CentOS7 repos, which is required for sdkmanager to run
- name: Bail out if not supported - name: Bail out if not supported
when: when:
- "ansible_os_family == 'RedHat' and ansible_distribution_version is version('8.0', '<')" - "ansible_os_family == 'RedHat' and ansible_distribution_version is version('8.0', '<')"
ansible.builtin.meta: end_play ansible.builtin.meta: end_play
- name: Run android_sdk tests - name: Run android_sdk tests
environment: environment:
PATH: '{{ ansible_env.PATH }}:{{ android_sdk_location }}/cmdline-tools/latest/bin' PATH: '{{ ansible_env.PATH }}:{{ android_sdk_location }}/cmdline-tools/latest/bin'
block: block:
- import_tasks: setup.yml - import_tasks: setup.yml
- name: Run default tests - name: Run default tests
import_tasks: default-tests.yml import_tasks: default-tests.yml
when: ansible_os_family != 'FreeBSD' when: ansible_os_family != 'FreeBSD'
# Most of the important Android SDK packages are not available on FreeBSD (like, build-tools, platform-tools and so on), # Most of the important Android SDK packages are not available on FreeBSD (like, build-tools, platform-tools and so on),
# but at least some of the functionality can be tested (like, downloading sources) # but at least some of the functionality can be tested (like, downloading sources)
- name: Run FreeBSD tests - name: Run FreeBSD tests
import_tasks: freebsd-tests.yml import_tasks: freebsd-tests.yml
when: ansible_os_family == 'FreeBSD' when: ansible_os_family == 'FreeBSD'

View file

@ -82,7 +82,7 @@
unarchive: unarchive:
src: "{{ commandline_tools_link }}" src: "{{ commandline_tools_link }}"
dest: "{{ android_cmdline_temp_dir }}" dest: "{{ android_cmdline_temp_dir }}"
remote_src: yes remote_src: true
creates: "{{ android_cmdline_temp_dir }}/cmdline-tools" creates: "{{ android_cmdline_temp_dir }}/cmdline-tools"
when: not sdkmanager_installed.stat.exists when: not sdkmanager_installed.stat.exists
@ -91,4 +91,4 @@
copy: copy:
src: "{{ android_cmdline_temp_dir }}/cmdline-tools/" src: "{{ android_cmdline_temp_dir }}/cmdline-tools/"
dest: "{{ android_sdk_location }}/cmdline-tools/latest" dest: "{{ android_sdk_location }}/cmdline-tools/latest"
remote_src: yes remote_src: true

View file

@ -19,8 +19,8 @@
- name: Assert collection netbox.netbox was installed - name: Assert collection netbox.netbox was installed
assert: assert:
that: that:
- install_c0 is changed - install_c0 is changed
- '"netbox.netbox" in install_c0.new_collections' - '"netbox.netbox" in install_c0.new_collections'
- name: Install collection netbox.netbox (again) - name: Install collection netbox.netbox (again)
community.general.ansible_galaxy_install: community.general.ansible_galaxy_install:
@ -32,7 +32,7 @@
- name: Assert collection was not installed - name: Assert collection was not installed
assert: assert:
that: that:
- install_c1 is not changed - install_c1 is not changed
################################################### ###################################################
- name: Make directory install_r - name: Make directory install_r
@ -50,8 +50,8 @@
- name: Assert collection ansistrano.deploy was installed - name: Assert collection ansistrano.deploy was installed
assert: assert:
that: that:
- install_r0 is changed - install_r0 is changed
- '"ansistrano.deploy" in install_r0.new_roles' - '"ansistrano.deploy" in install_r0.new_roles'
- name: Install role ansistrano.deploy (again) - name: Install role ansistrano.deploy (again)
community.general.ansible_galaxy_install: community.general.ansible_galaxy_install:
@ -63,7 +63,7 @@
- name: Assert role was not installed - name: Assert role was not installed
assert: assert:
that: that:
- install_r1 is not changed - install_r1 is not changed
################################################### ###################################################
- name: Set requirements file path - name: Set requirements file path
@ -85,9 +85,9 @@
- name: Assert requirements file was installed - name: Assert requirements file was installed
assert: assert:
that: that:
- install_rq0 is changed - install_rq0 is changed
- '"geerlingguy.java" in install_rq0.new_roles' - '"geerlingguy.java" in install_rq0.new_roles'
- '"geerlingguy.php_roles" in install_rq0.new_collections' - '"geerlingguy.php_roles" in install_rq0.new_collections'
- name: Install from requirements file (again) - name: Install from requirements file (again)
community.general.ansible_galaxy_install: community.general.ansible_galaxy_install:
@ -99,7 +99,7 @@
- name: Assert requirements file was not installed - name: Assert requirements file was not installed
assert: assert:
that: that:
- install_rq1 is not changed - install_rq1 is not changed
################################################### ###################################################
- name: Make directory upgrade_c - name: Make directory upgrade_c
@ -117,8 +117,8 @@
- name: Assert collection netbox.netbox was installed - name: Assert collection netbox.netbox was installed
assert: assert:
that: that:
- upgrade_c0 is changed - upgrade_c0 is changed
- '"netbox.netbox" in upgrade_c0.new_collections' - '"netbox.netbox" in upgrade_c0.new_collections'
- name: Upgrade collection netbox.netbox - name: Upgrade collection netbox.netbox
community.general.ansible_galaxy_install: community.general.ansible_galaxy_install:
@ -139,5 +139,5 @@
- name: Assert collection was not installed - name: Assert collection was not installed
assert: assert:
that: that:
- upgrade_c1 is changed - upgrade_c1 is changed
- upgrade_c2 is not changed - upgrade_c2 is not changed

View file

@ -15,11 +15,11 @@
- assert: - assert:
that: that:
- "'warnings' in disable_mpm_modules" - "'warnings' in disable_mpm_modules"
- disable_mpm_modules["warnings"] == [ - disable_mpm_modules["warnings"] == [
"No MPM module loaded! apache2 reload AND other module actions will fail if no MPM module is loaded immediately.", "No MPM module loaded! apache2 reload AND other module actions will fail if no MPM module is loaded immediately.",
"No MPM module loaded! apache2 reload AND other module actions will fail if no MPM module is loaded immediately." "No MPM module loaded! apache2 reload AND other module actions will fail if no MPM module is loaded immediately."
] ]
- name: Enable MPM event module - Revert previous change - name: Enable MPM event module - Revert previous change
apache2_module: apache2_module:
@ -44,4 +44,4 @@
- assert: - assert:
that: that:
- "'warnings' not in disable_mpm_modules" - "'warnings' not in disable_mpm_modules"

View file

@ -67,141 +67,141 @@
- name: Debian/Ubuntu specific tests - name: Debian/Ubuntu specific tests
when: "ansible_os_family == 'Debian'" when: "ansible_os_family == 'Debian'"
block: block:
- name: force disable of autoindex # bug #2499 - name: force disable of autoindex # bug #2499
community.general.apache2_module: community.general.apache2_module:
name: autoindex name: autoindex
state: absent
force: true
- name: re-enable autoindex
community.general.apache2_module:
name: autoindex
state: present
# mod_evasive is enabled by default upon the installation, so disable first and enable second, to preserve the config
- name: disable evasive module
community.general.apache2_module:
name: evasive
state: absent
- name: enable evasive module, test https://github.com/ansible/ansible/issues/22635
community.general.apache2_module:
name: evasive
state: present
- name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
community.general.apache2_module:
name: dump_io
state: present
ignore_errors: true
register: enable_dumpio_wrong
- name: disable dump_io
community.general.apache2_module:
name: dump_io
identifier: dumpio_module
state: absent
- name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
community.general.apache2_module:
name: dump_io
identifier: dumpio_module
state: present
register: enable_dumpio_correct_1
- name: ensure idempotency with identifier
community.general.apache2_module:
name: dump_io
identifier: dumpio_module
state: present
register: enable_dumpio_correct_2
- name: disable dump_io
community.general.apache2_module:
name: dump_io
identifier: dumpio_module
state: absent
- assert:
that:
- enable_dumpio_wrong is failed
- enable_dumpio_correct_1 is changed
- enable_dumpio_correct_2 is not changed
- name: disable mpm modules
community.general.apache2_module:
name: "{{ item }}"
state: absent
ignore_configcheck: true
with_items:
- mpm_worker
- mpm_event
- mpm_prefork
- name: enabled mpm_event
community.general.apache2_module:
name: mpm_event
state: present
ignore_configcheck: true
register: enabledmpmevent
- name: ensure changed mpm_event
assert:
that:
- 'enabledmpmevent.changed'
- name: switch between mpm_event and mpm_worker
community.general.apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
ignore_configcheck: true
with_items:
- name: mpm_event
state: absent state: absent
- name: mpm_worker force: true
- name: re-enable autoindex
community.general.apache2_module:
name: autoindex
state: present state: present
- name: ensure mpm_worker is already enabled # mod_evasive is enabled by default upon the installation, so disable first and enable second, to preserve the config
community.general.apache2_module: - name: disable evasive module
name: mpm_worker community.general.apache2_module:
state: present name: evasive
register: enabledmpmworker state: absent
- name: ensure mpm_worker unchanged - name: enable evasive module, test https://github.com/ansible/ansible/issues/22635
assert: community.general.apache2_module:
that: name: evasive
- 'not enabledmpmworker.changed' state: present
- name: try to disable all mpm modules with configcheck - name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
community.general.apache2_module: community.general.apache2_module:
name: "{{item}}" name: dump_io
state: absent state: present
with_items: ignore_errors: true
- mpm_worker register: enable_dumpio_wrong
- mpm_event
- mpm_prefork
ignore_errors: true
register: remove_with_configcheck
- name: ensure configcheck fails task with when run without mpm modules - name: disable dump_io
assert: community.general.apache2_module:
that: name: dump_io
- "{{ item.failed }}" identifier: dumpio_module
with_items: "{{ remove_with_configcheck.results }}" state: absent
- name: try to disable all mpm modules without configcheck - name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
community.general.apache2_module: community.general.apache2_module:
name: "{{item}}" name: dump_io
state: absent identifier: dumpio_module
ignore_configcheck: true state: present
with_items: register: enable_dumpio_correct_1
- mpm_worker
- mpm_event
- mpm_prefork
- name: enabled mpm_event to restore previous state - name: ensure idempotency with identifier
community.general.apache2_module: community.general.apache2_module:
name: mpm_event name: dump_io
state: present identifier: dumpio_module
ignore_configcheck: true state: present
register: enabledmpmevent register: enable_dumpio_correct_2
- name: disable dump_io
community.general.apache2_module:
name: dump_io
identifier: dumpio_module
state: absent
- assert:
that:
- enable_dumpio_wrong is failed
- enable_dumpio_correct_1 is changed
- enable_dumpio_correct_2 is not changed
- name: disable mpm modules
community.general.apache2_module:
name: "{{ item }}"
state: absent
ignore_configcheck: true
with_items:
- mpm_worker
- mpm_event
- mpm_prefork
- name: enabled mpm_event
community.general.apache2_module:
name: mpm_event
state: present
ignore_configcheck: true
register: enabledmpmevent
- name: ensure changed mpm_event
assert:
that:
- 'enabledmpmevent.changed'
- name: switch between mpm_event and mpm_worker
community.general.apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
ignore_configcheck: true
with_items:
- name: mpm_event
state: absent
- name: mpm_worker
state: present
- name: ensure mpm_worker is already enabled
community.general.apache2_module:
name: mpm_worker
state: present
register: enabledmpmworker
- name: ensure mpm_worker unchanged
assert:
that:
- 'not enabledmpmworker.changed'
- name: try to disable all mpm modules with configcheck
community.general.apache2_module:
name: "{{item}}"
state: absent
with_items:
- mpm_worker
- mpm_event
- mpm_prefork
ignore_errors: true
register: remove_with_configcheck
- name: ensure configcheck fails task with when run without mpm modules
assert:
that:
- "{{ item.failed }}"
with_items: "{{ remove_with_configcheck.results }}"
- name: try to disable all mpm modules without configcheck
community.general.apache2_module:
name: "{{item}}"
state: absent
ignore_configcheck: true
with_items:
- mpm_worker
- mpm_event
- mpm_prefork
- name: enabled mpm_event to restore previous state
community.general.apache2_module:
name: mpm_event
state: present
ignore_configcheck: true
register: enabledmpmevent

View file

@ -4,15 +4,15 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
btrfs_subvolume_single_configs: btrfs_subvolume_single_configs:
- file: "/tmp/disks0.img" - file: "/tmp/disks0.img"
loop: "/dev/loop95" loop: "/dev/loop95"
btrfs_subvolume_multiple_configs: btrfs_subvolume_multiple_configs:
- file: "/tmp/diskm0.img" - file: "/tmp/diskm0.img"
loop: "/dev/loop97" loop: "/dev/loop97"
- file: "/tmp/diskm1.img" - file: "/tmp/diskm1.img"
loop: "/dev/loop98" loop: "/dev/loop98"
- file: "/tmp/diskm2.img" - file: "/tmp/diskm2.img"
loop: "/dev/loop99" loop: "/dev/loop99"
btrfs_subvolume_configs: "{{ btrfs_subvolume_single_configs + btrfs_subvolume_multiple_configs }}" btrfs_subvolume_configs: "{{ btrfs_subvolume_single_configs + btrfs_subvolume_multiple_configs }}"
btrfs_subvolume_single_devices: "{{ btrfs_subvolume_single_configs | map(attribute='loop') }}" btrfs_subvolume_single_devices: "{{ btrfs_subvolume_single_configs | map(attribute='loop') }}"
btrfs_subvolume_single_label: "single" btrfs_subvolume_single_label: "single"

View file

@ -8,22 +8,22 @@
name: name:
- btrfs-progs # btrfs userspace - btrfs-progs # btrfs userspace
- util-linux # losetup - util-linux # losetup
ignore_errors: True ignore_errors: true
register: btrfs_installed register: btrfs_installed
- name: Execute integration tests tests - name: Execute integration tests tests
block: block:
- ansible.builtin.include_tasks: 'setup.yml' - ansible.builtin.include_tasks: 'setup.yml'
- name: "Execute test scenario for single device filesystem" - name: "Execute test scenario for single device filesystem"
ansible.builtin.include_tasks: 'run_filesystem_tests.yml' ansible.builtin.include_tasks: 'run_filesystem_tests.yml'
vars: vars:
btrfs_subvolume_target_device: "{{ btrfs_subvolume_single_devices | first }}" btrfs_subvolume_target_device: "{{ btrfs_subvolume_single_devices | first }}"
btrfs_subvolume_target_label: "{{ btrfs_subvolume_single_label }}" btrfs_subvolume_target_label: "{{ btrfs_subvolume_single_label }}"
- name: "Execute test scenario for multiple device configuration" - name: "Execute test scenario for multiple device configuration"
ansible.builtin.include_tasks: 'run_filesystem_tests.yml' ansible.builtin.include_tasks: 'run_filesystem_tests.yml'
vars: vars:
btrfs_subvolume_target_device: "{{ btrfs_subvolume_multiple_devices | first }}" btrfs_subvolume_target_device: "{{ btrfs_subvolume_multiple_devices | first }}"
btrfs_subvolume_target_label: "{{ btrfs_subvolume_multiple_label }}" btrfs_subvolume_target_label: "{{ btrfs_subvolume_multiple_label }}"
when: btrfs_installed is success when: btrfs_installed is success

View file

@ -10,23 +10,23 @@
- name: "Execute test scenarios where non-root subvolume is mounted" - name: "Execute test scenarios where non-root subvolume is mounted"
block: block:
- name: Create subvolume '/nonroot' - name: Create subvolume '/nonroot'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
name: "/nonroot" name: "/nonroot"
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
state: "present" state: "present"
register: nonroot register: nonroot
- name: "Mount subvolume '/nonroot'" - name: "Mount subvolume '/nonroot'"
ansible.posix.mount: ansible.posix.mount:
src: "{{ nonroot.filesystem.devices | first }}" src: "{{ nonroot.filesystem.devices | first }}"
path: /mnt path: /mnt
opts: "subvolid={{ nonroot.target_subvolume_id }}" opts: "subvolid={{ nonroot.target_subvolume_id }}"
fstype: btrfs fstype: btrfs
state: mounted state: mounted
- name: "Run tests for explicit, mounted single device configuration" - name: "Run tests for explicit, mounted single device configuration"
ansible.builtin.include_tasks: 'run_common_tests.yml' ansible.builtin.include_tasks: 'run_common_tests.yml'
- name: "Unmount subvolume /nonroot" - name: "Unmount subvolume /nonroot"
ansible.posix.mount: ansible.posix.mount:
path: /mnt path: /mnt
state: absent state: absent

View file

@ -18,12 +18,12 @@
- name: Create single device btrfs filesystem - name: Create single device btrfs filesystem
ansible.builtin.command: ansible.builtin.command:
cmd: "mkfs.btrfs --label {{ btrfs_subvolume_single_label }} -f {{ btrfs_subvolume_single_devices | first }}" cmd: "mkfs.btrfs --label {{ btrfs_subvolume_single_label }} -f {{ btrfs_subvolume_single_devices | first }}"
changed_when: True changed_when: true
- name: Create multiple device btrfs filesystem - name: Create multiple device btrfs filesystem
ansible.builtin.command: ansible.builtin.command:
cmd: "mkfs.btrfs --label {{ btrfs_subvolume_multiple_label }} -f -d raid0 {{ btrfs_subvolume_multiple_devices | join(' ') }}" cmd: "mkfs.btrfs --label {{ btrfs_subvolume_multiple_label }} -f -d raid0 {{ btrfs_subvolume_multiple_devices | join(' ') }}"
changed_when: True changed_when: true
# Typically created by udev, but apparently missing on Alpine # Typically created by udev, but apparently missing on Alpine
- name: Create btrfs control device node - name: Create btrfs control device node
@ -34,4 +34,4 @@
- name: Force rescan to ensure all device are detected - name: Force rescan to ensure all device are detected
ansible.builtin.command: ansible.builtin.command:
cmd: "btrfs device scan" cmd: "btrfs device scan"
changed_when: True changed_when: true

View file

@ -5,76 +5,76 @@
- name: "Match targeted filesystem by label" - name: "Match targeted filesystem by label"
block: block:
- name: Match '{{ btrfs_subvolume_target_label }}' filesystem by label - name: Match '{{ btrfs_subvolume_target_label }}' filesystem by label
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
name: "/match_label" name: "/match_label"
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
state: "present" state: "present"
register: result register: result
- name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen - name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result.filesystem.label == btrfs_subvolume_target_label - result.filesystem.label == btrfs_subvolume_target_label
- name: "Match targeted filesystem by uuid" - name: "Match targeted filesystem by uuid"
block: block:
- name: Match '{{ btrfs_subvolume_target_label }}' filesystem by uuid - name: Match '{{ btrfs_subvolume_target_label }}' filesystem by uuid
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
name: "/match_uuid" name: "/match_uuid"
filesystem_uuid: "{{ result.filesystem.uuid }}" filesystem_uuid: "{{ result.filesystem.uuid }}"
state: "present" state: "present"
register: result register: result
- name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen - name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result.filesystem.label == btrfs_subvolume_target_label - result.filesystem.label == btrfs_subvolume_target_label
- name: "Match targeted filesystem by devices" - name: "Match targeted filesystem by devices"
block: block:
- name: Match '{{ btrfs_subvolume_target_label }}' filesystem by device - name: Match '{{ btrfs_subvolume_target_label }}' filesystem by device
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
name: "/match_device" name: "/match_device"
filesystem_device: "{{ result.filesystem.devices | first }}" filesystem_device: "{{ result.filesystem.devices | first }}"
state: "present" state: "present"
register: result register: result
- name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen - name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result.filesystem.label == btrfs_subvolume_target_label - result.filesystem.label == btrfs_subvolume_target_label
- name: "Match only mounted filesystem" - name: "Match only mounted filesystem"
block: block:
- name: "Mount filesystem '{{ btrfs_subvolume_target_label }}'" - name: "Mount filesystem '{{ btrfs_subvolume_target_label }}'"
ansible.posix.mount: ansible.posix.mount:
src: "{{ result.filesystem.devices | first }}" src: "{{ result.filesystem.devices | first }}"
path: /mnt path: /mnt
opts: "subvolid={{ 5 }}" opts: "subvolid={{ 5 }}"
fstype: btrfs fstype: btrfs
state: mounted state: mounted
- name: Print current status - name: Print current status
community.general.btrfs_info: community.general.btrfs_info:
- name: Match '{{ btrfs_subvolume_target_label }}' filesystem when only mount - name: Match '{{ btrfs_subvolume_target_label }}' filesystem when only mount
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
name: "/match_only_mounted" name: "/match_only_mounted"
state: "present" state: "present"
register: result register: result
- name: "Unmount filesystem '{{ btrfs_subvolume_target_label }}'" - name: "Unmount filesystem '{{ btrfs_subvolume_target_label }}'"
ansible.posix.mount: ansible.posix.mount:
path: /mnt path: /mnt
state: absent state: absent
- name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen - name: Validate the '{{ btrfs_subvolume_target_label }}' filesystem was chosen
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result.filesystem.label == btrfs_subvolume_target_label - result.filesystem.label == btrfs_subvolume_target_label
when: False # TODO don't attempt this if the host already has a pre-existing btrfs filesystem when: false # TODO don't attempt this if the host already has a pre-existing btrfs filesystem

View file

@ -5,37 +5,37 @@
- name: Create a snapshot, overwriting if one already exists at path - name: Create a snapshot, overwriting if one already exists at path
block: block:
- name: Create a snapshot named 'snapshot_clobber' - name: Create a snapshot named 'snapshot_clobber'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_clobber" name: "/snapshot_clobber"
snapshot_source: "/" snapshot_source: "/"
snapshot_conflict: "clobber" snapshot_conflict: "clobber"
state: "present" state: "present"
register: result register: result
- name: Snapshot 'snapshot_clobber' created - name: Snapshot 'snapshot_clobber' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a snapshot named 'snapshot_clobber' (no idempotency) - name: Create a snapshot named 'snapshot_clobber' (no idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_clobber" name: "/snapshot_clobber"
snapshot_source: "/" snapshot_source: "/"
snapshot_conflict: "clobber" snapshot_conflict: "clobber"
state: "present" state: "present"
register: result register: result
- name: Snapshot 'snapshot_clobber' created (no idempotency) - name: Snapshot 'snapshot_clobber' created (no idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Cleanup created snapshot - name: Cleanup created snapshot
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_clobber" name: "/snapshot_clobber"
state: "absent" state: "absent"

View file

@ -5,38 +5,38 @@
- name: Create a snapshot, erroring if one already exists at path - name: Create a snapshot, erroring if one already exists at path
block: block:
- name: Create a snapshot named 'snapshot_error' - name: Create a snapshot named 'snapshot_error'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_error" name: "/snapshot_error"
snapshot_source: "/" snapshot_source: "/"
snapshot_conflict: "error" snapshot_conflict: "error"
state: "present" state: "present"
register: result register: result
- name: Snapshot 'snapshot_error' created - name: Snapshot 'snapshot_error' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a snapshot named 'snapshot_error' (no idempotency) - name: Create a snapshot named 'snapshot_error' (no idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_error" name: "/snapshot_error"
snapshot_source: "/" snapshot_source: "/"
snapshot_conflict: "error" snapshot_conflict: "error"
state: "present" state: "present"
register: result register: result
ignore_errors: true ignore_errors: true
- name: Snapshot 'snapshot_error' created (no idempotency) - name: Snapshot 'snapshot_error' created (no idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Cleanup created snapshot - name: Cleanup created snapshot
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_error" name: "/snapshot_error"
state: "absent" state: "absent"

View file

@ -5,37 +5,37 @@
- name: Create a snapshot if one does not already exist at path - name: Create a snapshot if one does not already exist at path
block: block:
- name: Create a snapshot named 'snapshot_skip' - name: Create a snapshot named 'snapshot_skip'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_skip" name: "/snapshot_skip"
snapshot_source: "/" snapshot_source: "/"
snapshot_conflict: "skip" snapshot_conflict: "skip"
state: "present" state: "present"
register: result register: result
- name: Snapshot 'snapshot_skip' created - name: Snapshot 'snapshot_skip' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a snapshot named 'snapshot_skip' (idempotency) - name: Create a snapshot named 'snapshot_skip' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_skip" name: "/snapshot_skip"
snapshot_source: "/" snapshot_source: "/"
snapshot_conflict: "skip" snapshot_conflict: "skip"
state: "present" state: "present"
register: result register: result
- name: Snapshot 'snapshot_skip' created (idempotency) - name: Snapshot 'snapshot_skip' created (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Cleanup created snapshot - name: Cleanup created snapshot
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/snapshot_skip" name: "/snapshot_skip"
state: "absent" state: "absent"

View file

@ -5,95 +5,95 @@
- name: Change the default subvolume - name: Change the default subvolume
block: block:
- name: Update filesystem default subvolume to '@' - name: Update filesystem default subvolume to '@'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
default: True default: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/@" name: "/@"
state: "present" state: "present"
register: result register: result
- name: Subvolume '@' set to default - name: Subvolume '@' set to default
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Update filesystem default subvolume to '@' (idempotency) - name: Update filesystem default subvolume to '@' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
default: True default: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/@" name: "/@"
state: "present" state: "present"
register: result register: result
- name: Subvolume '@' set to default (idempotency) - name: Subvolume '@' set to default (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Revert the default subvolume - name: Revert the default subvolume
block: block:
- name: Revert filesystem default subvolume to '/' - name: Revert filesystem default subvolume to '/'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
default: True default: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/" name: "/"
state: "present" state: "present"
register: result register: result
- name: Subvolume '/' set to default - name: Subvolume '/' set to default
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Revert filesystem default subvolume to '/' (idempotency) - name: Revert filesystem default subvolume to '/' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
default: True default: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/" name: "/"
state: "present" state: "present"
register: result register: result
- name: Subvolume '/' set to default (idempotency) - name: Subvolume '/' set to default (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Change the default subvolume again - name: Change the default subvolume again
block: block:
- name: Update filesystem default subvolume to '@' - name: Update filesystem default subvolume to '@'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
default: True default: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/@" name: "/@"
state: "present" state: "present"
register: result register: result
- name: Subvolume '@' set to default - name: Subvolume '@' set to default
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Revert custom default subvolume to fs_tree root when deleted - name: Revert custom default subvolume to fs_tree root when deleted
block: block:
- name: Delete custom default subvolume '@' - name: Delete custom default subvolume '@'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/@" name: "/@"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume '@' deleted - name: Subvolume '@' deleted
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Delete custom default subvolume '@' (idempotency) - name: Delete custom default subvolume '@' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/@" name: "/@"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume '@' deleted (idempotency) - name: Subvolume '@' deleted (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed

View file

@ -5,57 +5,57 @@
- name: Create parent subvolume 'container' - name: Create parent subvolume 'container'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container" name: "/container"
state: "present" state: "present"
- name: Create a nested subvolume - name: Create a nested subvolume
block: block:
- name: Create a subvolume named 'nested' inside 'container' - name: Create a subvolume named 'nested' inside 'container'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/nested" name: "/container/nested"
state: "present" state: "present"
register: result register: result
- name: Subvolume 'container/nested' created - name: Subvolume 'container/nested' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a subvolume named 'nested' inside 'container' (idempotency) - name: Create a subvolume named 'nested' inside 'container' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/nested" name: "/container/nested"
state: "present" state: "present"
register: result register: result
- name: Subvolume 'container/nested' created (idempotency) - name: Subvolume 'container/nested' created (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Remove a nested subvolume - name: Remove a nested subvolume
block: block:
- name: Remove a subvolume named 'nested' inside 'container' - name: Remove a subvolume named 'nested' inside 'container'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/nested" name: "/container/nested"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume 'container/nested' removed - name: Subvolume 'container/nested' removed
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Remove a subvolume named 'nested' inside 'container' (idempotency) - name: Remove a subvolume named 'nested' inside 'container' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/nested" name: "/container/nested"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume 'container/nested' removed (idempotency) - name: Subvolume 'container/nested' removed (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed

View file

@ -5,82 +5,82 @@
- name: Recursively create subvolumes - name: Recursively create subvolumes
block: block:
- name: Create a subvolume named '/recursive/son/grandson' - name: Create a subvolume named '/recursive/son/grandson'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/recursive/son/grandson" name: "/recursive/son/grandson"
recursive: Yes recursive: true
state: "present" state: "present"
register: result register: result
- name: Subvolume named '/recursive/son/grandson' created - name: Subvolume named '/recursive/son/grandson' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a subvolume named '/recursive/son/grandson' (idempotency) - name: Create a subvolume named '/recursive/son/grandson' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/recursive/son/grandson" name: "/recursive/son/grandson"
recursive: Yes recursive: true
state: "present" state: "present"
register: result register: result
- name: Subvolume named '/recursive/son/grandson' created (idempotency) - name: Subvolume named '/recursive/son/grandson' created (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Create a subvolume named '/recursive/daughter/granddaughter' - name: Create a subvolume named '/recursive/daughter/granddaughter'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/recursive/daughter/granddaughter" name: "/recursive/daughter/granddaughter"
recursive: Yes recursive: true
state: "present" state: "present"
register: result register: result
- name: Subvolume named '/recursive/son/grandson' created - name: Subvolume named '/recursive/son/grandson' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a subvolume named '/recursive/daughter/granddaughter' (idempotency) - name: Create a subvolume named '/recursive/daughter/granddaughter' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/recursive/daughter/granddaughter" name: "/recursive/daughter/granddaughter"
recursive: Yes recursive: true
state: "present" state: "present"
register: result register: result
- name: Subvolume named '/recursive/son/grandson' created (idempotency) - name: Subvolume named '/recursive/son/grandson' created (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Recursively remove subvolumes - name: Recursively remove subvolumes
block: block:
- name: Remove subvolume '/recursive' and all descendents - name: Remove subvolume '/recursive' and all descendents
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/recursive" name: "/recursive"
recursive: Yes recursive: true
state: "absent" state: "absent"
register: result register: result
- name: Subvolume '/recursive' removed - name: Subvolume '/recursive' removed
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Remove subvolume '/recursive' and all descendents (idempotency) - name: Remove subvolume '/recursive' and all descendents (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/recursive" name: "/recursive"
recursive: Yes recursive: true
state: "absent" state: "absent"
register: result register: result
- name: Subvolume '/recursive' removed (idempotency) - name: Subvolume '/recursive' removed (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed

View file

@ -5,50 +5,50 @@
- name: Create a simple subvolume - name: Create a simple subvolume
block: block:
- name: Create a subvolume named 'simple' - name: Create a subvolume named 'simple'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/simple" name: "/simple"
state: "present" state: "present"
register: result register: result
- name: Subvolume named 'simple' created - name: Subvolume named 'simple' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a subvolume named 'simple' (idempotency) - name: Create a subvolume named 'simple' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/simple" name: "/simple"
state: "present" state: "present"
register: result register: result
- name: Subvolume named 'simple' created (idempotency) - name: Subvolume named 'simple' created (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Remove a simple subvolume - name: Remove a simple subvolume
block: block:
- name: Remove a subvolume named 'simple' - name: Remove a subvolume named 'simple'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/simple" name: "/simple"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume named 'simple' removed - name: Subvolume named 'simple' removed
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Remove a subvolume named 'simple' (idempotency) - name: Remove a subvolume named 'simple' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/simple" name: "/simple"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume named 'simple' removed (idempotency) - name: Subvolume named 'simple' removed (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed

View file

@ -5,58 +5,58 @@
- name: Create a subvolume named 'container' - name: Create a subvolume named 'container'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container" name: "/container"
state: "present" state: "present"
- name: Create a subvolume with whitespace in the name - name: Create a subvolume with whitespace in the name
block: block:
- name: Create a subvolume named 'container/my data' - name: Create a subvolume named 'container/my data'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/my data" name: "/container/my data"
state: "present" state: "present"
register: result register: result
- name: Subvolume named 'container/my data' created - name: Subvolume named 'container/my data' created
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Create a subvolume named 'container/my data' (idempotency) - name: Create a subvolume named 'container/my data' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/my data" name: "/container/my data"
state: "present" state: "present"
register: result register: result
- name: Subvolume named 'container/my data' created (idempotency) - name: Subvolume named 'container/my data' created (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed
- name: Remove a subvolume with whitespace in the name - name: Remove a subvolume with whitespace in the name
block: block:
- name: Remove a subvolume named 'container/my data' - name: Remove a subvolume named 'container/my data'
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/my data" name: "/container/my data"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume named 'container/my data' removed - name: Subvolume named 'container/my data' removed
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is changed - result is changed
- name: Remove a subvolume named 'container/my data' (idempotency) - name: Remove a subvolume named 'container/my data' (idempotency)
community.general.btrfs_subvolume: community.general.btrfs_subvolume:
automount: Yes automount: true
filesystem_label: "{{ btrfs_subvolume_target_label }}" filesystem_label: "{{ btrfs_subvolume_target_label }}"
name: "/container/my data" name: "/container/my data"
state: "absent" state: "absent"
register: result register: result
- name: Subvolume named 'container/my data' removed (idempotency) - name: Subvolume named 'container/my data' removed (idempotency)
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- result is not changed - result is not changed

View file

@ -9,59 +9,59 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
- block: - block:
- name: Create temporary playbook files - name: Create temporary playbook files
tempfile: tempfile:
state: file state: file
suffix: temp suffix: temp
loop: "{{ tests }}" loop: "{{ tests }}"
loop_control: loop_control:
loop_var: test loop_var: test
label: "{{ test.name }}" label: "{{ test.name }}"
register: temporary_playbook_files register: temporary_playbook_files
- name: Set temporary playbook file content - name: Set temporary playbook file content
copy: copy:
content: "{{ test.playbook }}" content: "{{ test.playbook }}"
dest: "{{ temporary_playbook_files.results[test_idx].path }}" dest: "{{ temporary_playbook_files.results[test_idx].path }}"
loop: "{{ tests }}" loop: "{{ tests }}"
loop_control: loop_control:
loop_var: test loop_var: test
index_var: test_idx index_var: test_idx
label: "{{ test.name }}" label: "{{ test.name }}"
- name: Collect outputs - name: Collect outputs
command: "ansible-playbook -i {{ inventory }} {{ playbook }}" command: "ansible-playbook -i {{ inventory }} {{ playbook }}"
environment: "{{ test.environment }}" environment: "{{ test.environment }}"
loop: "{{ tests }}" loop: "{{ tests }}"
loop_control: loop_control:
loop_var: test loop_var: test
label: "{{ test.name }}" label: "{{ test.name }}"
register: outputs register: outputs
changed_when: false changed_when: false
vars: vars:
inventory: "{{ role_path }}/inventory.yml" inventory: "{{ role_path }}/inventory.yml"
playbook: " playbook: "
{%- for result in temporary_playbook_files.results -%} {%- for result in temporary_playbook_files.results -%}
{%- if result.test.name == test.name -%} {%- if result.test.name == test.name -%}
{{- result.path -}} {{- result.path -}}
{%- endif -%} {%- endif -%}
{%- endfor -%}" {%- endfor -%}"
- name: Assert test output equals expected output - name: Assert test output equals expected output
assert: assert:
that: result.output.differences | length == 0 that: result.output.differences | length == 0
loop: "{{ outputs.results | callback_results_extractor }}" loop: "{{ outputs.results | callback_results_extractor }}"
loop_control: loop_control:
loop_var: result loop_var: result
label: "{{ result.name }}" label: "{{ result.name }}"
register: assertions register: assertions
always: always:
- name: Remove temporary playbooks - name: Remove temporary playbooks
file: file:
path: "{{ temporary_file.path }}" path: "{{ temporary_file.path }}"
state: absent state: absent
loop: "{{ temporary_playbook_files.results }}" loop: "{{ temporary_playbook_files.results }}"
loop_control: loop_control:
loop_var: temporary_file loop_var: temporary_file
label: "{{ temporary_file.test.name }}: {{ temporary_file.path }}" label: "{{ temporary_file.test.name }}: {{ temporary_file.path }}"

View file

@ -41,22 +41,21 @@
content: | content: |
Foo bar Foo bar
Bar baz bam! Bar baz bam!
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Gathering Facts] *********************************************************", - "TASK [Gathering Facts] *********************************************************"
"ok: [testhost]", - "ok: [testhost]"
"", - ""
"TASK [Create file] *************************************************************", - "TASK [Create file] *************************************************************"
"changed: [testhost]", - "changed: [testhost]"
"", - ""
"TASK [Modify file] *************************************************************", - "TASK [Modify file] *************************************************************"
"changed: [testhost]", - "changed: [testhost]"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 ", - "testhost : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
always: always:
- name: Clean up temp file - name: Clean up temp file

View file

@ -25,18 +25,17 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set playbook_on_start_msg callback using environment variable - name: Set playbook_on_start_msg callback using environment variable
environment: environment:
@ -51,19 +50,18 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"Sample output Sample playbook message", - "Sample output Sample playbook message"
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set playbook_on_play_start_msg callback using play variable - name: Set playbook_on_play_start_msg callback using play variable
environment: environment:
@ -80,17 +78,16 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"Sample output Sample play name", - "Sample output Sample play name"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set playbook_on_task_start_msg callback using play variable - name: Set playbook_on_task_start_msg callback using play variable
environment: environment:
@ -106,17 +103,16 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"Sample output Sample task name", - "Sample output Sample task name"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set playbook_on_task_start_msg callback using task variable - name: Set playbook_on_task_start_msg callback using task variable
environment: environment:
@ -132,17 +128,16 @@
msg: sample debug msg msg: sample debug msg
vars: vars:
ansible_callback_diy_playbook_on_task_start_msg: Sample output {{ ansible_callback_diy.task.name }} ansible_callback_diy_playbook_on_task_start_msg: Sample output {{ ansible_callback_diy.task.name }}
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"Sample output Sample task name", - "Sample output Sample task name"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set runner_on_ok_msg callback using task variable - name: Set runner_on_ok_msg callback using task variable
environment: environment:
@ -158,16 +153,15 @@
msg: sample debug msg msg: sample debug msg
vars: vars:
ansible_callback_diy_runner_on_ok_msg: Sample output {{ ansible_callback_diy.result.output.msg }} ansible_callback_diy_runner_on_ok_msg: Sample output {{ ansible_callback_diy.result.output.msg }}
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"Sample output sample debug msg", - "Sample output sample debug msg"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set runner_on_failed_msg callback using task variable - name: Set runner_on_failed_msg callback using task variable
environment: environment:
@ -185,16 +179,15 @@
ignore_errors: true ignore_errors: true
vars: vars:
ansible_callback_diy_runner_on_failed_msg: Sample output Sample failure message ansible_callback_diy_runner_on_failed_msg: Sample output Sample failure message
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"Sample output Sample failure message", - "Sample output Sample failure message"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1 "
]
- name: Set runner_on_skipped_msg callback using task variable - name: Set runner_on_skipped_msg callback using task variable
environment: environment:
@ -211,16 +204,15 @@
when: false when: false
vars: vars:
ansible_callback_diy_runner_on_skipped_msg: Sample output Skipped {{ ansible_callback_diy.task.name }} ansible_callback_diy_runner_on_skipped_msg: Sample output Skipped {{ ansible_callback_diy.task.name }}
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"Sample output Skipped Sample task name", - "Sample output Skipped Sample task name"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=0 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 " - "testhost : ok=0 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 "
]
- name: Set runner_item_on_ok_msg callback using task variable - name: Set runner_item_on_ok_msg callback using task variable
environment: environment:
@ -240,18 +232,17 @@
- sample item 3 - sample item 3
vars: vars:
ansible_callback_diy_runner_item_on_ok_msg: Sample output Looping {{ ansible_callback_diy.result.output.msg }} ansible_callback_diy_runner_item_on_ok_msg: Sample output Looping {{ ansible_callback_diy.result.output.msg }}
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"Sample output Looping sample debug msg sample item 1", - "Sample output Looping sample debug msg sample item 1"
"Sample output Looping sample debug msg sample item 2", - "Sample output Looping sample debug msg sample item 2"
"Sample output Looping sample debug msg sample item 3", - "Sample output Looping sample debug msg sample item 3"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set runner_item_on_failed_msg callback using task variable - name: Set runner_item_on_failed_msg callback using task variable
environment: environment:
@ -273,28 +264,25 @@
ignore_errors: true ignore_errors: true
vars: vars:
ansible_callback_diy_runner_item_on_failed_msg: Sample output Looping sample failure message ansible_callback_diy_runner_item_on_failed_msg: Sample output Looping sample failure message
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => (item=sample item 1) => {", - "ok: [testhost] => (item=sample item 1) => {"
" \"msg\": \"sample debug msg sample item 1\"", - " \"msg\": \"sample debug msg sample item 1\""
"}", - "}"
"Sample output Looping sample failure message", - "Sample output Looping sample failure message"
"ok: [testhost] => (item=sample item 3) => {", - "ok: [testhost] => (item=sample item 3) => {"
" \"msg\": \"sample debug msg sample item 3\"", - " \"msg\": \"sample debug msg sample item 3\""
"}", - "}"
[ - # Apparently a bug was fixed in Ansible, as before it ran through with "All items completed"
# Apparently a bug was fixed in Ansible, as before it ran through with "All items completed" - "fatal: [testhost]: FAILED! => {\"msg\": \"All items completed\"}"
"fatal: [testhost]: FAILED! => {\"msg\": \"All items completed\"}", - "fatal: [testhost]: FAILED! => {\"msg\": \"One or more items failed\"}"
"fatal: [testhost]: FAILED! => {\"msg\": \"One or more items failed\"}", - "...ignoring"
], - ""
"...ignoring", - "PLAY RECAP *********************************************************************"
"", - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1 "
"PLAY RECAP *********************************************************************",
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1 "
]
- name: Set runner_item_on_skipped_msg callback using task variable - name: Set runner_item_on_skipped_msg callback using task variable
environment: environment:
@ -315,22 +303,21 @@
when: item != 'sample item 2' when: item != 'sample item 2'
vars: vars:
ansible_callback_diy_runner_item_on_skipped_msg: Sample output Looping Skipped {{ ansible_callback_diy.result.output.item }} ansible_callback_diy_runner_item_on_skipped_msg: Sample output Looping Skipped {{ ansible_callback_diy.result.output.item }}
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => (item=sample item 1) => {", - "ok: [testhost] => (item=sample item 1) => {"
" \"msg\": \"sample debug msg sample item 1\"", - " \"msg\": \"sample debug msg sample item 1\""
"}", - "}"
"Sample output Looping Skipped sample item 2", - "Sample output Looping Skipped sample item 2"
"ok: [testhost] => (item=sample item 3) => {", - "ok: [testhost] => (item=sample item 3) => {"
" \"msg\": \"sample debug msg sample item 3\"", - " \"msg\": \"sample debug msg sample item 3\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set playbook_on_stats_msg callback using play variable - name: Set playbook_on_stats_msg callback using play variable
environment: environment:
@ -371,20 +358,19 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
" Sample output stats", - " Sample output stats"
"===============================", - "==============================="
" ok : testhost: 1", - " ok : testhost: 1"
"", - ""
" processed : testhost: 1" - " processed : testhost: 1"
]
- name: Suppress output on playbook_on_task_start_msg callback using task variable - name: Suppress output on playbook_on_task_start_msg callback using task variable
environment: environment:
@ -400,16 +386,15 @@
msg: sample debug msg msg: sample debug msg
vars: vars:
ansible_callback_diy_playbook_on_task_start_msg: '' ansible_callback_diy_playbook_on_task_start_msg: ''
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Suppress output on runner_on_ok_msg callback using task variable - name: Suppress output on runner_on_ok_msg callback using task variable
environment: environment:
@ -425,15 +410,14 @@
msg: sample debug msg msg: sample debug msg
vars: vars:
ansible_callback_diy_runner_on_ok_msg: '' ansible_callback_diy_runner_on_ok_msg: ''
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Set runner_on_ok_msg_color using task variable - name: Set runner_on_ok_msg_color using task variable
environment: environment:
@ -450,13 +434,12 @@
vars: vars:
ansible_callback_diy_runner_on_ok_msg: Sample output {{ ansible_callback_diy.result.output.msg }} ansible_callback_diy_runner_on_ok_msg: Sample output {{ ansible_callback_diy.result.output.msg }}
ansible_callback_diy_runner_on_ok_msg_color: blue ansible_callback_diy_runner_on_ok_msg_color: blue
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"Sample output sample debug msg", - "Sample output sample debug msg"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]

View file

@ -24,18 +24,17 @@
- name: Sample task - name: Sample task
debug: debug:
msg: This is a test msg: This is a test
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task] *************************************************************", - "TASK [Sample task] *************************************************************"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"This is a test\"", - " \"msg\": \"This is a test\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: community.general.print_task is enabled - name: community.general.print_task is enabled
environment: environment:
@ -49,23 +48,22 @@
- name: Sample task - name: Sample task
debug: debug:
msg: This is a test msg: This is a test
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task] *************************************************************", - "TASK [Sample task] *************************************************************"
"", - ""
"- name: Sample task", - "- name: Sample task"
" debug:", - " debug:"
" msg: This is a test", - " msg: This is a test"
"", - ""
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"This is a test\"", - " \"msg\": \"This is a test\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Print with msg parameter on the same line - name: Print with msg parameter on the same line
environment: environment:
@ -78,22 +76,21 @@
tasks: tasks:
- name: Sample task - name: Sample task
debug: msg="This is a test" debug: msg="This is a test"
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task] *************************************************************", - "TASK [Sample task] *************************************************************"
"", - ""
"- name: Sample task", - "- name: Sample task"
" debug: msg=\"This is a test\"", - " debug: msg=\"This is a test\""
"", - ""
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"This is a test\"", - " \"msg\": \"This is a test\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Task with additional parameters - name: Task with additional parameters
environment: environment:
@ -110,23 +107,22 @@
test_var: "Hello World" test_var: "Hello World"
debug: debug:
var: test_var var: test_var
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task] *************************************************************", - "TASK [Sample task] *************************************************************"
"", - ""
"- name: Sample task", - "- name: Sample task"
" when: true", - " when: true"
" vars:", - " vars:"
" test_var: Hello World", - " test_var: Hello World"
" debug:", - " debug:"
" var: test_var", - " var: test_var"
"", - ""
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"test_var\": \"Hello World\"", - " \"test_var\": \"Hello World\""
"}", - "}"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]

View file

@ -26,18 +26,17 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ******************************************************* 15:04:05", - "PLAY [testhost] ******************************************************* 15:04:05"
"", - ""
"TASK [Sample task name] *********************************************** 15:04:05", - "TASK [Sample task name] *********************************************** 15:04:05"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP ************************************************************ 15:04:05", - "PLAY RECAP ************************************************************ 15:04:05"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Enable timestamp in the longer length - name: Enable timestamp in the longer length
environment: environment:
@ -52,15 +51,14 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ******************************************** 2006-01-02T15:04:05", - "PLAY [testhost] ******************************************** 2006-01-02T15:04:05"
"", - ""
"TASK [Sample task name] ************************************ 2006-01-02T15:04:05", - "TASK [Sample task name] ************************************ 2006-01-02T15:04:05"
"ok: [testhost] => {", - "ok: [testhost] => {"
" \"msg\": \"sample debug msg\"", - " \"msg\": \"sample debug msg\""
"}", - "}"
"", - ""
"PLAY RECAP ************************************************* 2006-01-02T15:04:05", - "PLAY RECAP ************************************************* 2006-01-02T15:04:05"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]

View file

@ -25,17 +25,17 @@
- name: Sample task name - name: Sample task name
debug: debug:
msg: sample debug msg msg: sample debug msg
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Sample task name] ********************************************************", - "TASK [Sample task name] ********************************************************"
"ok: [testhost] => ", - "ok: [testhost] => "
" msg: sample debug msg", - " msg: sample debug msg"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Test umlauts in multiline - name: Test umlauts in multiline
environment: environment:
ANSIBLE_NOCOLOR: 'true' ANSIBLE_NOCOLOR: 'true'
@ -48,20 +48,20 @@
- name: Umlaut output - name: Umlaut output
debug: debug:
msg: "äöü\néêè\nßï☺" msg: "äöü\néêè\nßï☺"
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Umlaut output] ***********************************************************", - "TASK [Umlaut output] ***********************************************************"
"ok: [testhost] => ", - "ok: [testhost] => "
" msg: |-", - " msg: |-"
" äöü", - " äöü"
" éêè", - " éêè"
" ßï☺", - " ßï☺"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]
- name: Test to_yaml - name: Test to_yaml
environment: environment:
ANSIBLE_NOCOLOR: 'true' ANSIBLE_NOCOLOR: 'true'
@ -79,21 +79,20 @@
- name: Test to_yaml - name: Test to_yaml
debug: debug:
msg: "{{ data | to_yaml }}" msg: "{{ data | to_yaml }}"
expected_output: [ expected_output:
"", - ""
"PLAY [testhost] ****************************************************************", - "PLAY [testhost] ****************************************************************"
"", - ""
"TASK [Test to_yaml] ************************************************************", - "TASK [Test to_yaml] ************************************************************"
"ok: [testhost] => ", - "ok: [testhost] => "
" msg: |-", - " msg: |-"
" 'line 1", - " 'line 1"
" ", - " "
" line 2", - " line 2"
" ", - " "
" line 3", - " line 3"
" ", - " "
" '", - " '"
"", - ""
"PLAY RECAP *********************************************************************", - "PLAY RECAP *********************************************************************"
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 " - "testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
]

View file

@ -14,9 +14,9 @@
CARGO_NET_GIT_FETCH_WITH_CLI: "true" CARGO_NET_GIT_FETCH_WITH_CLI: "true"
when: has_cargo | default(false) and ansible_distribution == 'Alpine' when: has_cargo | default(false) and ansible_distribution == 'Alpine'
- block: - block:
- import_tasks: test_general.yml - import_tasks: test_general.yml
- import_tasks: test_version.yml - import_tasks: test_version.yml
- import_tasks: test_directory.yml - import_tasks: test_directory.yml
environment: "{{ cargo_environment }}" environment: "{{ cargo_environment }}"
when: has_cargo | default(false) when: has_cargo | default(false)
- import_tasks: test_rustup_cargo.yml - import_tasks: test_rustup_cargo.yml

View file

@ -4,12 +4,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
- block: - block:
- name: Install cargo - name: Install cargo
package: package:
name: cargo name: cargo
state: present state: present
- set_fact: - set_fact:
has_cargo: true has_cargo: true
when: when:
- ansible_system != 'FreeBSD' - ansible_system != 'FreeBSD'
- ansible_distribution != 'MacOSX' - ansible_distribution != 'MacOSX'
@ -18,25 +18,25 @@
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=') - ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=')
- block: - block:
- name: Install rust (containing cargo) - name: Install rust (containing cargo)
package: package:
name: rust name: rust
state: present state: present
- set_fact: - set_fact:
has_cargo: true has_cargo: true
when: when:
- ansible_system == 'FreeBSD' and ansible_distribution_version is version('13.0', '>') - ansible_system == 'FreeBSD' and ansible_distribution_version is version('13.0', '>')
- block: - block:
- name: Download rustup - name: Download rustup
get_url: get_url:
url: https://sh.rustup.rs url: https://sh.rustup.rs
dest: /tmp/sh.rustup.rs dest: /tmp/sh.rustup.rs
mode: "0750" mode: "0750"
force: true force: true
- name: Install rustup cargo - name: Install rustup cargo
command: /tmp/sh.rustup.rs -y command: /tmp/sh.rustup.rs -y
- set_fact: - set_fact:
rustup_cargo_bin: "{{ lookup('env', 'HOME') }}/.cargo/bin/cargo" rustup_cargo_bin: "{{ lookup('env', 'HOME') }}/.cargo/bin/cargo"
when: when:
- ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=') - ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=')

View file

@ -29,7 +29,7 @@
- name: Check assertions helloworld - name: Check assertions helloworld
assert: assert:
that: that:
- uninstall_absent_helloworld is not changed - uninstall_absent_helloworld is not changed
- install_absent_helloworld is changed - install_absent_helloworld is changed
- install_present_helloworld is not changed - install_present_helloworld is not changed
- uninstall_present_helloworld is changed - uninstall_present_helloworld is changed

View file

@ -19,5 +19,5 @@
- name: Check assertions helloworld - name: Check assertions helloworld
assert: assert:
that: that:
- rustup_install_absent_helloworld is changed - rustup_install_absent_helloworld is changed
- rustup_uninstall_present_helloworld is changed - rustup_uninstall_present_helloworld is changed

View file

@ -42,9 +42,9 @@
- name: Check assertions helloworld-yliu - name: Check assertions helloworld-yliu
assert: assert:
that: that:
- install_helloworld_010 is changed - install_helloworld_010 is changed
- install_helloworld_010_idem is not changed - install_helloworld_010_idem is not changed
- upgrade_helloworld_010 is changed - upgrade_helloworld_010 is changed
- upgrade_helloworld_010_idem is not changed - upgrade_helloworld_010_idem is not changed
- downgrade_helloworld_010 is changed - downgrade_helloworld_010 is changed
- downgrade_helloworld_010_idem is not changed - downgrade_helloworld_010_idem is not changed

View file

@ -25,53 +25,53 @@
# Will also have to skip on OpenSUSE when running on Python 2 on newer Leap versions # Will also have to skip on OpenSUSE when running on Python 2 on newer Leap versions
# (!= 42 and >= 15) as cloud-init will install the Python 3 package, breaking our build on py2. # (!= 42 and >= 15) as cloud-init will install the Python 3 package, breaking our build on py2.
when: when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14) - not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14)
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3) - not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3)
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int == 15) - not (ansible_os_family == "Suse" and ansible_distribution_major_version|int == 15)
- not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int == 8) # TODO: cannot start service - not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int == 8) # TODO: cannot start service
- not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors? - not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors?
- not (ansible_distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect - not (ansible_distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect
block: block:
- name: setup install cloud-init - name: setup install cloud-init
package: package:
name: name:
- cloud-init - cloud-init
- udev - udev
- name: Ensure systemd-network user exists - name: Ensure systemd-network user exists
user: user:
name: systemd-network name: systemd-network
state: present state: present
when: ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 37 when: ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 37
- name: setup run cloud-init - name: setup run cloud-init
service: service:
name: cloud-init-local name: cloud-init-local
state: restarted state: restarted
- name: test gather cloud-init facts in check mode - name: test gather cloud-init facts in check mode
cloud_init_data_facts: cloud_init_data_facts:
check_mode: true check_mode: true
register: result register: result
- name: verify test gather cloud-init facts in check mode - name: verify test gather cloud-init facts in check mode
assert: assert:
that: that:
- result.cloud_init_data_facts.status.v1 is defined - result.cloud_init_data_facts.status.v1 is defined
- result.cloud_init_data_facts.status.v1.stage is defined - result.cloud_init_data_facts.status.v1.stage is defined
- not result.cloud_init_data_facts.status.v1.stage - not result.cloud_init_data_facts.status.v1.stage
- cloud_init_data_facts.status.v1 is defined - cloud_init_data_facts.status.v1 is defined
- cloud_init_data_facts.status.v1.stage is defined - cloud_init_data_facts.status.v1.stage is defined
- not cloud_init_data_facts.status.v1.stage - not cloud_init_data_facts.status.v1.stage
- name: test gather cloud-init facts - name: test gather cloud-init facts
cloud_init_data_facts: cloud_init_data_facts:
register: result register: result
- name: verify test gather cloud-init facts - name: verify test gather cloud-init facts
assert: assert:
that: that:
- result.cloud_init_data_facts.status.v1 is defined - result.cloud_init_data_facts.status.v1 is defined
- result.cloud_init_data_facts.status.v1.stage is defined - result.cloud_init_data_facts.status.v1.stage is defined
- not result.cloud_init_data_facts.status.v1.stage - not result.cloud_init_data_facts.status.v1.stage
- cloud_init_data_facts.status.v1 is defined - cloud_init_data_facts.status.v1 is defined
- cloud_init_data_facts.status.v1.stage is defined - cloud_init_data_facts.status.v1.stage is defined
- not cloud_init_data_facts.status.v1.stage - not cloud_init_data_facts.status.v1.stage

View file

@ -8,41 +8,41 @@
serial: 1 serial: 1
tasks: tasks:
### raw with unicode arg and output ### raw with unicode arg and output
- name: raw with unicode arg and output - name: raw with unicode arg and output
raw: echo 汉语 raw: echo 汉语
register: command register: command
- name: check output of raw with unicode arg and output - name: check output of raw with unicode arg and output
assert: assert:
that: that:
- "'汉语' in command.stdout" - "'汉语' in command.stdout"
- command is changed # as of 2.2, raw should default to changed: true for consistency w/ shell/command/script modules - command is changed # as of 2.2, raw should default to changed: true for consistency w/ shell/command/script modules
### copy local file with unicode filename and content ### copy local file with unicode filename and content
- name: create local file with unicode filename and content - name: create local file with unicode filename and content
local_action: lineinfile dest={{ local_tmp }}-汉语/汉语.txt create=true line=汉语 local_action: lineinfile dest={{ local_tmp }}-汉语/汉语.txt create=true line=汉语
- name: remove remote file with unicode filename and content - name: remove remote file with unicode filename and content
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语/汉语.txt state=absent" action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语/汉语.txt state=absent"
- name: create remote directory with unicode name - name: create remote directory with unicode name
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=directory" action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=directory"
- name: copy local file with unicode filename and content - name: copy local file with unicode filename and content
action: "{{ action_prefix }}copy src={{ local_tmp }}-汉语/汉语.txt dest={{ remote_tmp }}-汉语/汉语.txt" action: "{{ action_prefix }}copy src={{ local_tmp }}-汉语/汉语.txt dest={{ remote_tmp }}-汉语/汉语.txt"
### fetch remote file with unicode filename and content ### fetch remote file with unicode filename and content
- name: remove local file with unicode filename and content - name: remove local file with unicode filename and content
local_action: file path={{ local_tmp }}-汉语/汉语.txt state=absent local_action: file path={{ local_tmp }}-汉语/汉语.txt state=absent
- name: fetch remote file with unicode filename and content - name: fetch remote file with unicode filename and content
fetch: src={{ remote_tmp }}-汉语/汉语.txt dest={{ local_tmp }}-汉语/汉语.txt fail_on_missing=true validate_checksum=true flat=true fetch: src={{ remote_tmp }}-汉语/汉语.txt dest={{ local_tmp }}-汉语/汉语.txt fail_on_missing=true validate_checksum=true flat=true
### remove local and remote temp files ### remove local and remote temp files
- name: remove local temp file - name: remove local temp file
local_action: file path={{ local_tmp }}-汉语 state=absent local_action: file path={{ local_tmp }}-汉语 state=absent
- name: remove remote temp file - name: remove remote temp file
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=absent" action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=absent"
### test wait_for_connection plugin ### test wait_for_connection plugin
- ansible.builtin.wait_for_connection: - ansible.builtin.wait_for_connection:

View file

@ -10,7 +10,7 @@
copy: copy:
content: "" content: ""
dest: "{{ remote_tmp }}/test_empty.txt" dest: "{{ remote_tmp }}/test_empty.txt"
force: no force: false
mode: '0644' mode: '0644'
- name: assert file without content exists - name: assert file without content exists

View file

@ -15,10 +15,10 @@
- result is changed - result is changed
- result.data.Value == 'somevalue' - result.data.Value == 'somevalue'
#- name: Test the lookup # - name: Test the lookup
# assert: # assert:
# that: # that:
# - lookup('community.general.consul_kv', 'somekey', token=consul_management_token) == 'somevalue' # - lookup('community.general.consul_kv', 'somekey', token=consul_management_token) == 'somevalue'
- name: Update a key with the same data - name: Update a key with the same data
consul_kv: consul_kv:

View file

@ -44,7 +44,7 @@
consul_role: consul_role:
name: foo-role-with-policy name: foo-role-with-policy
description: "Testing updating description" description: "Testing updating description"
check_mode: yes check_mode: true
register: result register: result
- assert: - assert:
@ -106,7 +106,7 @@
datacenters: datacenters:
- dc2 - dc2
register: result register: result
check_mode: yes check_mode: true
- assert: - assert:
that: that:
@ -146,7 +146,7 @@
name: role-with-service-identity name: role-with-service-identity
node_identities: [] node_identities: []
register: result register: result
check_mode: yes check_mode: true
- assert: - assert:
that: that:

View file

@ -14,96 +14,96 @@
consul_uri: https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_{{ ansible_system | lower }}_{{ consul_arch }}.zip consul_uri: https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_{{ ansible_system | lower }}_{{ consul_arch }}.zip
consul_cmd: '{{ remote_tmp_dir }}/consul' consul_cmd: '{{ remote_tmp_dir }}/consul'
block: block:
- name: Install requests<2.20 (CentOS/RHEL 6) - name: Install requests<2.20 (CentOS/RHEL 6)
pip: pip:
name: requests<2.20 name: requests<2.20
extra_args: "-c {{ remote_constraints }}" extra_args: "-c {{ remote_constraints }}"
register: result register: result
until: result is success until: result is success
when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=') when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=')
- name: Install python-consul - name: Install python-consul
pip: pip:
name: python-consul name: python-consul
extra_args: "-c {{ remote_constraints }}" extra_args: "-c {{ remote_constraints }}"
register: result register: result
until: result is success until: result is success
- name: Generate privatekey - name: Generate privatekey
community.crypto.openssl_privatekey: community.crypto.openssl_privatekey:
path: '{{ remote_tmp_dir }}/privatekey.pem' path: '{{ remote_tmp_dir }}/privatekey.pem'
- name: Generate CSR - name: Generate CSR
community.crypto.openssl_csr: community.crypto.openssl_csr:
path: '{{ remote_tmp_dir }}/csr.csr' path: '{{ remote_tmp_dir }}/csr.csr'
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem' privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
subject: subject:
commonName: localhost commonName: localhost
- name: Generate selfsigned certificate - name: Generate selfsigned certificate
register: selfsigned_certificate register: selfsigned_certificate
community.crypto.x509_certificate: community.crypto.x509_certificate:
path: '{{ remote_tmp_dir }}/cert.pem' path: '{{ remote_tmp_dir }}/cert.pem'
csr_path: '{{ remote_tmp_dir }}/csr.csr' csr_path: '{{ remote_tmp_dir }}/csr.csr'
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem' privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
provider: selfsigned provider: selfsigned
selfsigned_digest: sha256 selfsigned_digest: sha256
- name: Install unzip - name: Install unzip
package: package:
name: unzip name: unzip
register: result register: result
until: result is success until: result is success
when: ansible_distribution != "MacOSX" when: ansible_distribution != "MacOSX"
- assert: - assert:
that: ansible_architecture in ['i386', 'x86_64', 'amd64'] that: ansible_architecture in ['i386', 'x86_64', 'amd64']
- set_fact:
consul_arch: '386'
when: ansible_architecture == 'i386'
- set_fact:
consul_arch: amd64
when: ansible_architecture in ['x86_64', 'amd64']
- name: Download consul binary
unarchive:
src: '{{ consul_uri }}'
dest: '{{ remote_tmp_dir }}'
remote_src: true
register: result
until: result is success
- vars:
remote_dir: '{{ echo_remote_tmp_dir.stdout }}'
block:
- command: echo {{ remote_tmp_dir }}
register: echo_remote_tmp_dir
- name: Create configuration file
template:
src: consul_config.hcl.j2
dest: '{{ remote_tmp_dir }}/consul_config.hcl'
- name: Start Consul (dev mode enabled)
shell: nohup {{ consul_cmd }} agent -dev -config-file {{ remote_tmp_dir }}/consul_config.hcl </dev/null >/dev/null 2>&1 &
- name: Bootstrap ACL
consul_acl_bootstrap:
register: consul_bootstrap_result
- set_fact: - set_fact:
consul_management_token: '{{ consul_bootstrap_result.result.SecretID }}' consul_arch: '386'
- name: Create some data when: ansible_architecture == 'i386'
command: '{{ consul_cmd }} kv put -token={{consul_management_token}} data/value{{ item }} foo{{ item }}' - set_fact:
loop: consul_arch: amd64
- 1 when: ansible_architecture in ['x86_64', 'amd64']
- 2 - name: Download consul binary
- 3 unarchive:
- import_tasks: consul_general.yml src: '{{ consul_uri }}'
- import_tasks: consul_kv.yml dest: '{{ remote_tmp_dir }}'
remote_src: true
register: result
until: result is success
- vars:
remote_dir: '{{ echo_remote_tmp_dir.stdout }}'
block:
- command: echo {{ remote_tmp_dir }}
register: echo_remote_tmp_dir
- name: Create configuration file
template:
src: consul_config.hcl.j2
dest: '{{ remote_tmp_dir }}/consul_config.hcl'
- name: Start Consul (dev mode enabled)
shell: nohup {{ consul_cmd }} agent -dev -config-file {{ remote_tmp_dir }}/consul_config.hcl </dev/null >/dev/null 2>&1 &
- name: Bootstrap ACL
consul_acl_bootstrap:
register: consul_bootstrap_result
- set_fact:
consul_management_token: '{{ consul_bootstrap_result.result.SecretID }}'
- name: Create some data
command: '{{ consul_cmd }} kv put -token={{consul_management_token}} data/value{{ item }} foo{{ item }}'
loop:
- 1
- 2
- 3
- import_tasks: consul_general.yml
- import_tasks: consul_kv.yml
- block: - block:
- import_tasks: consul_session.yml - import_tasks: consul_session.yml
- import_tasks: consul_policy.yml - import_tasks: consul_policy.yml
- import_tasks: consul_role.yml - import_tasks: consul_role.yml
- import_tasks: consul_token.yml - import_tasks: consul_token.yml
- import_tasks: consul_auth_method.yml - import_tasks: consul_auth_method.yml
- import_tasks: consul_binding_rule.yml - import_tasks: consul_binding_rule.yml
- import_tasks: consul_agent_service.yml - import_tasks: consul_agent_service.yml
- import_tasks: consul_agent_check.yml - import_tasks: consul_agent_check.yml
module_defaults: module_defaults:
group/community.general.consul: group/community.general.consul:
token: "{{ consul_management_token }}" token: "{{ consul_management_token }}"
always: always:
- name: Kill consul process - name: Kill consul process
shell: kill $(cat {{ remote_tmp_dir }}/consul.pid) shell: kill $(cat {{ remote_tmp_dir }}/consul.pid)
ignore_errors: true ignore_errors: true

View file

@ -11,133 +11,133 @@
or (ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' or (ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
and ansible_distribution_major_version | int >= 8) and ansible_distribution_major_version | int >= 8)
block: block:
- debug: var=copr_chroot - debug: var=copr_chroot
- name: enable copr project - name: enable copr project
copr: copr:
host: copr.fedorainfracloud.org host: copr.fedorainfracloud.org
state: enabled state: enabled
name: '{{ copr_fullname }}' name: '{{ copr_fullname }}'
chroot: "{{ copr_chroot }}" chroot: "{{ copr_chroot }}"
register: result register: result
- name: assert that the copr project was enabled - name: assert that the copr project was enabled
assert: assert:
that: that:
- 'result is changed' - 'result is changed'
- result.msg == 'enabled' - result.msg == 'enabled'
- result.info == 'Please note that this repository is not part of the main distribution' - result.info == 'Please note that this repository is not part of the main distribution'
- name: enable copr project - name: enable copr project
check_mode: true check_mode: true
copr: copr:
state: enabled state: enabled
name: '{{ copr_fullname }}' name: '{{ copr_fullname }}'
chroot: '{{ copr_chroot }}' chroot: '{{ copr_chroot }}'
register: result register: result
- name: assert that the copr project was enabled - name: assert that the copr project was enabled
assert: assert:
that: that:
- result is not changed - result is not changed
- result.msg == 'enabled' - result.msg == 'enabled'
- name: Ensure the repo is installed and enabled | slurp - name: Ensure the repo is installed and enabled | slurp
register: result register: result
ansible.builtin.slurp: ansible.builtin.slurp:
src: "{{ copr_repofile }}" src: "{{ copr_repofile }}"
- name: Ensure the repo is installed and enabled - name: Ensure the repo is installed and enabled
vars: vars:
content: "{{ result.content | b64decode }}" content: "{{ result.content | b64decode }}"
_baseurl: "{{ 'https://download.copr.fedorainfracloud.org/results/gotmax23/community.general.copr_integration_tests' | regex_escape }}" _baseurl: "{{ 'https://download.copr.fedorainfracloud.org/results/gotmax23/community.general.copr_integration_tests' | regex_escape }}"
baseurl: "{{ content | regex_search('baseurl=' ~ _baseurl) }}" baseurl: "{{ content | regex_search('baseurl=' ~ _baseurl) }}"
block: block:
- ansible.builtin.debug: - ansible.builtin.debug:
var: content var: content
- ansible.builtin.debug: - ansible.builtin.debug:
var: baseurl var: baseurl
- name: Ensure the repo is installed and enabled - name: Ensure the repo is installed and enabled
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- "'enabled=1' in content" - "'enabled=1' in content"
- baseurl | length > 0 - baseurl | length > 0
- name: Install test package from Copr - name: Install test package from Copr
when: when:
# Copr does not build new packages for EOL Fedoras. # Copr does not build new packages for EOL Fedoras.
- > - >
not (ansible_distribution == 'Fedora' and not (ansible_distribution == 'Fedora' and
ansible_distribution_major_version | int < 35) ansible_distribution_major_version | int < 35)
block: block:
- name: install test package from the copr - name: install test package from the copr
ansible.builtin.package: ansible.builtin.package:
update_cache: true update_cache: true
name: copr-module-integration-dummy-package name: copr-module-integration-dummy-package
- name: uninstall test package - name: uninstall test package
register: result register: result
ansible.builtin.package: ansible.builtin.package:
name: copr-module-integration-dummy-package name: copr-module-integration-dummy-package
state: absent state: absent
- name: check uninstall test package - name: check uninstall test package
ansible.builtin.assert: ansible.builtin.assert:
that: result.changed | bool that: result.changed | bool
- name: remove copr project - name: remove copr project
copr: copr:
state: absent state: absent
name: '{{ copr_fullname }}' name: '{{ copr_fullname }}'
register: result register: result
- name: assert that the copr project was removed - name: assert that the copr project was removed
assert: assert:
that: that:
- 'result is changed' - 'result is changed'
- result.msg == 'absent' - result.msg == 'absent'
- name: Ensure the repo file was removed | stat - name: Ensure the repo file was removed | stat
register: result register: result
ansible.builtin.stat: ansible.builtin.stat:
dest: "{{ copr_repofile }}" dest: "{{ copr_repofile }}"
- name: Ensure the repo file was removed - name: Ensure the repo file was removed
ansible.builtin.assert: ansible.builtin.assert:
that: not result.stat.exists | bool that: not result.stat.exists | bool
- name: disable copr project - name: disable copr project
copr: copr:
state: disabled state: disabled
name: '{{ copr_fullname }}' name: '{{ copr_fullname }}'
chroot: '{{ copr_chroot }}' chroot: '{{ copr_chroot }}'
register: result register: result
- name: assert that the copr project was disabled - name: assert that the copr project was disabled
assert: assert:
that: that:
- 'result is changed' - 'result is changed'
- result.msg == 'disabled' - result.msg == 'disabled'
- name: Ensure the repo is installed but disabled | slurp - name: Ensure the repo is installed but disabled | slurp
register: result register: result
ansible.builtin.slurp: ansible.builtin.slurp:
src: "{{ copr_repofile }}" src: "{{ copr_repofile }}"
- name: Ensure the repo is installed but disabled - name: Ensure the repo is installed but disabled
vars: vars:
content: "{{ result.content | b64decode }}" content: "{{ result.content | b64decode }}"
_baseurl: "{{ 'https://download.copr.fedorainfracloud.org/results/gotmax23/community.general.copr_integration_tests' | regex_escape }}" _baseurl: "{{ 'https://download.copr.fedorainfracloud.org/results/gotmax23/community.general.copr_integration_tests' | regex_escape }}"
baseurl: "{{ content | regex_search('baseurl=' ~ _baseurl) }}" baseurl: "{{ content | regex_search('baseurl=' ~ _baseurl) }}"
block: block:
- ansible.builtin.debug: - ansible.builtin.debug:
var: content var: content
- ansible.builtin.debug: - ansible.builtin.debug:
var: baseurl var: baseurl
- name: Ensure the repo is installed but disabled - name: Ensure the repo is installed but disabled
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- "'enabled=0' in content" - "'enabled=0' in content"
- baseurl | length > 0 - baseurl | length > 0
always: always:
- name: clean up - name: clean up

View file

@ -16,43 +16,43 @@
- name: Assert State=query with default parameters - name: Assert State=query with default parameters
assert: assert:
that: that:
- "'project_path' in deploy_helper" - "'project_path' in deploy_helper"
- "deploy_helper.current_path == deploy_helper.project_path ~ '/current'" - "deploy_helper.current_path == deploy_helper.project_path ~ '/current'"
- "deploy_helper.releases_path == deploy_helper.project_path ~ '/releases'" - "deploy_helper.releases_path == deploy_helper.project_path ~ '/releases'"
- "deploy_helper.shared_path == deploy_helper.project_path ~ '/shared'" - "deploy_helper.shared_path == deploy_helper.project_path ~ '/shared'"
- "deploy_helper.unfinished_filename == 'DEPLOY_UNFINISHED'" - "deploy_helper.unfinished_filename == 'DEPLOY_UNFINISHED'"
- "'previous_release' in deploy_helper" - "'previous_release' in deploy_helper"
- "'previous_release_path' in deploy_helper" - "'previous_release_path' in deploy_helper"
- "'new_release' in deploy_helper" - "'new_release' in deploy_helper"
- "'new_release_path' in deploy_helper" - "'new_release_path' in deploy_helper"
- "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release" - "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release"
- name: State=query with relative overridden paths - name: State=query with relative overridden paths
deploy_helper: path={{ deploy_helper_test_root }} current_path=CURRENT_PATH releases_path=RELEASES_PATH shared_path=SHARED_PATH state=query deploy_helper: path={{ deploy_helper_test_root }} current_path=CURRENT_PATH releases_path=RELEASES_PATH shared_path=SHARED_PATH state=query
- name: Assert State=query with relative overridden paths - name: Assert State=query with relative overridden paths
assert: assert:
that: that:
- "deploy_helper.current_path == deploy_helper.project_path ~ '/CURRENT_PATH'" - "deploy_helper.current_path == deploy_helper.project_path ~ '/CURRENT_PATH'"
- "deploy_helper.releases_path == deploy_helper.project_path ~ '/RELEASES_PATH'" - "deploy_helper.releases_path == deploy_helper.project_path ~ '/RELEASES_PATH'"
- "deploy_helper.shared_path == deploy_helper.project_path ~ '/SHARED_PATH'" - "deploy_helper.shared_path == deploy_helper.project_path ~ '/SHARED_PATH'"
- "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release" - "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release"
- name: State=query with absolute overridden paths - name: State=query with absolute overridden paths
deploy_helper: path={{ deploy_helper_test_root }} current_path=/CURRENT_PATH releases_path=/RELEASES_PATH shared_path=/SHARED_PATH state=query deploy_helper: path={{ deploy_helper_test_root }} current_path=/CURRENT_PATH releases_path=/RELEASES_PATH shared_path=/SHARED_PATH state=query
- name: Assert State=query with absolute overridden paths - name: Assert State=query with absolute overridden paths
assert: assert:
that: that:
- "deploy_helper.current_path == '/CURRENT_PATH'" - "deploy_helper.current_path == '/CURRENT_PATH'"
- "deploy_helper.releases_path == '/RELEASES_PATH'" - "deploy_helper.releases_path == '/RELEASES_PATH'"
- "deploy_helper.shared_path == '/SHARED_PATH'" - "deploy_helper.shared_path == '/SHARED_PATH'"
- "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release" - "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release"
- name: State=query with overridden unfinished_filename - name: State=query with overridden unfinished_filename
deploy_helper: path={{ deploy_helper_test_root }} unfinished_filename=UNFINISHED_DEPLOY state=query deploy_helper: path={{ deploy_helper_test_root }} unfinished_filename=UNFINISHED_DEPLOY state=query
- name: Assert State=query with overridden unfinished_filename - name: Assert State=query with overridden unfinished_filename
assert: assert:
that: that:
- "'UNFINISHED_DEPLOY' == deploy_helper.unfinished_filename" - "'UNFINISHED_DEPLOY' == deploy_helper.unfinished_filename"
# Remove the root folder just in case it exists # Remove the root folder just in case it exists
- file: path={{ deploy_helper_test_root }} state=absent - file: path={{ deploy_helper_test_root }} state=absent
@ -66,8 +66,8 @@
- name: Assert State=present with default parameters - name: Assert State=present with default parameters
assert: assert:
that: that:
- "releases_path.stat.exists" - "releases_path.stat.exists"
- "shared_path.stat.exists" - "shared_path.stat.exists"
# Setup older releases for tests # Setup older releases for tests
- file: path={{ deploy_helper.releases_path }}/{{ item }} state=directory - file: path={{ deploy_helper.releases_path }}/{{ item }} state=directory
@ -88,9 +88,9 @@
- name: Assert State=finalize with default parameters - name: Assert State=finalize with default parameters
assert: assert:
that: that:
- "current_path.stat.islnk" - "current_path.stat.islnk"
- "deploy_helper.new_release_path in current_path.stat.lnk_source" - "deploy_helper.new_release_path in current_path.stat.lnk_source"
- "not current_path_unfinished_filename.stat.exists" - "not current_path_unfinished_filename.stat.exists"
- stat: path={{ deploy_helper.releases_path }}/third - stat: path={{ deploy_helper.releases_path }}/third
register: third_release_path register: third_release_path
- shell: "ls {{ deploy_helper.releases_path }} | wc -l" - shell: "ls {{ deploy_helper.releases_path }} | wc -l"
@ -98,13 +98,13 @@
- name: Assert State=finalize with default parameters (clean=true checks) - name: Assert State=finalize with default parameters (clean=true checks)
assert: assert:
that: that:
- "not third_release_path.stat.exists" - "not third_release_path.stat.exists"
- "releases_count.stdout|trim == '6'" - "releases_count.stdout|trim == '6'"
- deploy_helper: path={{ deploy_helper_test_root }} release={{ deploy_helper.new_release }} state=query - deploy_helper: path={{ deploy_helper_test_root }} release={{ deploy_helper.new_release }} state=query
- name: Assert State=finalize with default parameters (previous_release checks) - name: Assert State=finalize with default parameters (previous_release checks)
assert: assert:
that: that:
- "deploy_helper.new_release == deploy_helper.previous_release" - "deploy_helper.new_release == deploy_helper.previous_release"
- name: State=absent with default parameters - name: State=absent with default parameters
deploy_helper: path={{ deploy_helper_test_root }} state=absent deploy_helper: path={{ deploy_helper_test_root }} state=absent
@ -113,7 +113,7 @@
- name: Assert State=absent with default parameters - name: Assert State=absent with default parameters
assert: assert:
that: that:
- "not project_path.stat.exists" - "not project_path.stat.exists"
- debug: msg="Clearing all release data and facts ---------" - debug: msg="Clearing all release data and facts ---------"
@ -127,8 +127,8 @@
- name: Assert State=present with shared_path set to False - name: Assert State=present with shared_path set to False
assert: assert:
that: that:
- "releases_path.stat.exists" - "releases_path.stat.exists"
- "deploy_helper.shared_path is falsy or not shared_path.stat.exists" - "deploy_helper.shared_path is falsy or not shared_path.stat.exists"
# Setup older releases for tests # Setup older releases for tests
- file: path={{ deploy_helper.releases_path }}/{{ item }} state=directory - file: path={{ deploy_helper.releases_path }}/{{ item }} state=directory
@ -151,9 +151,9 @@
- name: Assert State=finalize with default parameters (clean=true checks) - name: Assert State=finalize with default parameters (clean=true checks)
assert: assert:
that: that:
- "not third_release_path.stat.exists" - "not third_release_path.stat.exists"
- "before_releases_count.stdout|trim == '6'" - "before_releases_count.stdout|trim == '6'"
- "releases_count.stdout|trim == '3'" - "releases_count.stdout|trim == '3'"
# Remove the root folder # Remove the root folder
- file: path={{ deploy_helper_test_root }} state=absent - file: path={{ deploy_helper_test_root }} state=absent

View file

@ -3,5 +3,5 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
discord_id: 000 discord_id: 0
discord_token: xxx discord_token: xxx

View file

@ -177,7 +177,6 @@
- filesize_stat_basic_14.stat.checksum == filesize_test_checksum - filesize_stat_basic_14.stat.checksum == filesize_test_checksum
- name: Expand the file with 1 byte (57001B) (check mode) - name: Expand the file with 1 byte (57001B) (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"
@ -253,7 +252,6 @@
- filesize_stat_basic_24.stat.checksum != filesize_test_checksum - filesize_stat_basic_24.stat.checksum != filesize_test_checksum
- name: Expand the file up to 2 MiB (2*1024*1024 bytes) (check mode) - name: Expand the file up to 2 MiB (2*1024*1024 bytes) (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"
@ -327,7 +325,6 @@
- filesize_stat_basic_34.stat.size == 2*1024**2 - filesize_stat_basic_34.stat.size == 2*1024**2
- name: Truncate the file to 57kB (57000B) (check mode) - name: Truncate the file to 57kB (57000B) (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"
@ -404,7 +401,6 @@
- filesize_stat_basic_44.stat.checksum == filesize_test_checksum - filesize_stat_basic_44.stat.checksum == filesize_test_checksum
- name: Remove test file - name: Remove test file
ansible.builtin.file: ansible.builtin.file:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"

View file

@ -89,7 +89,6 @@
- filesize_stat_float_04.stat.size == 512512 - filesize_stat_float_04.stat.size == 512512
- name: Create a file with a size of 512.513kB (check mode) - name: Create a file with a size of 512.513kB (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"
@ -166,7 +165,6 @@
- filesize_stat_float_14.stat.size == 512513 - filesize_stat_float_14.stat.size == 512513
- name: Create a file with a size of 4.004MB (check mode) - name: Create a file with a size of 4.004MB (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"

View file

@ -119,7 +119,6 @@
- filesize_stat_sparse_06.stat.size == 2*1000**4 - filesize_stat_sparse_06.stat.size == 2*1000**4
- name: Change sparse file size to 2TiB (check mode) - name: Change sparse file size to 2TiB (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"
@ -198,7 +197,6 @@
- filesize_stat_sparse_14.stat.size == 2199023255552 - filesize_stat_sparse_14.stat.size == 2199023255552
- name: Change sparse file size to 2.321TB (check mode) - name: Change sparse file size to 2.321TB (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"
@ -279,7 +277,6 @@
- filesize_stat_sparse_24.stat.size == 2321000000000 - filesize_stat_sparse_24.stat.size == 2321000000000
- name: Remove test file - name: Remove test file
ansible.builtin.file: ansible.builtin.file:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"

View file

@ -13,14 +13,13 @@
- name: Create a broken symlink in the same directory - name: Create a broken symlink in the same directory
ansible.builtin.file: ansible.builtin.file:
src: "{{ filesize_testfile | basename }}" src: "{{ filesize_testfile | basename }}"
dest: "{{ filesize_testlink }}" dest: "{{ filesize_testlink }}"
state: link state: link
force: true force: true
follow: false follow: false
- name: Create a file with a size of 512 kB (512000 bytes) (check mode) - name: Create a file with a size of 512 kB (512000 bytes) (check mode)
community.general.filesize: community.general.filesize:
path: "{{ filesize_testlink }}" path: "{{ filesize_testlink }}"
@ -85,7 +84,6 @@
- filesize_test_symlink_04.path != filesize_testlink - filesize_test_symlink_04.path != filesize_testlink
- name: Remove test file - name: Remove test file
ansible.builtin.file: ansible.builtin.file:
path: "{{ filesize_testfile }}" path: "{{ filesize_testfile }}"

View file

@ -8,52 +8,52 @@
- new_uuid | default(False) - new_uuid | default(False)
- not (ansible_system == "FreeBSD" and fstype == "xfs") - not (ansible_system == "FreeBSD" and fstype == "xfs")
block: block:
- name: "Create filesystem ({{ fstype }})" - name: "Create filesystem ({{ fstype }})"
community.general.filesystem: community.general.filesystem:
dev: '{{ dev }}' dev: '{{ dev }}'
fstype: '{{ fstype }}' fstype: '{{ fstype }}'
register: fs_result register: fs_result
- name: "Get UUID of created filesystem" - name: "Get UUID of created filesystem"
ansible.builtin.shell: ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}" cmd: "{{ get_uuid_cmd }}"
changed_when: false changed_when: false
register: uuid register: uuid
- name: "Reset filesystem ({{ fstype }}) UUID" - name: "Reset filesystem ({{ fstype }}) UUID"
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
uuid: "{{ new_uuid }}"
register: fs_resetuuid_result
- name: "Get UUID of the filesystem"
ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}"
changed_when: false
register: uuid2
- name: "Assert that filesystem UUID is changed"
ansible.builtin.assert:
that:
- 'fs_resetuuid_result is changed'
- 'fs_resetuuid_result is success'
- 'uuid.stdout != uuid2.stdout'
- when:
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
(fstype == "xfs" and ansible_system == "Linux" and
ansible_distribution not in ["CentOS", "Ubuntu"])
block:
- name: "Reset filesystem ({{ fstype }}) UUID and resizefs"
ignore_errors: true
community.general.filesystem: community.general.filesystem:
dev: '{{ dev }}' dev: '{{ dev }}'
fstype: '{{ fstype }}' fstype: '{{ fstype }}'
uuid: "{{ new_uuid }}" uuid: "{{ new_uuid }}"
resizefs: true register: fs_resetuuid_result
register: fs_resetuuid_and_resizefs_result
- name: "Assert that filesystem UUID reset and resizefs failed" - name: "Get UUID of the filesystem"
ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}"
changed_when: false
register: uuid2
- name: "Assert that filesystem UUID is changed"
ansible.builtin.assert: ansible.builtin.assert:
that: fs_resetuuid_and_resizefs_result is failed that:
- 'fs_resetuuid_result is changed'
- 'fs_resetuuid_result is success'
- 'uuid.stdout != uuid2.stdout'
- when:
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
(fstype == "xfs" and ansible_system == "Linux" and
ansible_distribution not in ["CentOS", "Ubuntu"])
block:
- name: "Reset filesystem ({{ fstype }}) UUID and resizefs"
ignore_errors: true
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
uuid: "{{ new_uuid }}"
resizefs: true
register: fs_resetuuid_and_resizefs_result
- name: "Assert that filesystem UUID reset and resizefs failed"
ansible.builtin.assert:
that: fs_resetuuid_and_resizefs_result is failed

View file

@ -12,33 +12,33 @@
- new_uuid | default(False) - new_uuid | default(False)
- not (ansible_system == "FreeBSD" and fstype == "xfs") - not (ansible_system == "FreeBSD" and fstype == "xfs")
block: block:
- name: "Create filesystem ({{ fstype }}) with UUID" - name: "Create filesystem ({{ fstype }}) with UUID"
community.general.filesystem: community.general.filesystem:
dev: '{{ dev }}' dev: '{{ dev }}'
fstype: '{{ fstype }}' fstype: '{{ fstype }}'
uuid: '{{ random_uuid }}' uuid: '{{ random_uuid }}'
register: fs_result register: fs_result
- name: "Get UUID of the created filesystem" - name: "Get UUID of the created filesystem"
ansible.builtin.shell: ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}" cmd: "{{ get_uuid_cmd }}"
changed_when: false changed_when: false
register: uuid register: uuid
- name: "Assert that filesystem UUID is the random UUID set on creation" - name: "Assert that filesystem UUID is the random UUID set on creation"
ansible.builtin.assert: ansible.builtin.assert:
that: (random_uuid | replace('-','')) == ( uuid.stdout | replace('-','')) that: (random_uuid | replace('-','')) == ( uuid.stdout | replace('-',''))
- when: not (new_uuid | default(False)) - when: not (new_uuid | default(False))
block: block:
- name: "Create filesystem ({{ fstype }}) without UUID support" - name: "Create filesystem ({{ fstype }}) without UUID support"
ignore_errors: true ignore_errors: true
community.general.filesystem: community.general.filesystem:
dev: '{{ dev }}' dev: '{{ dev }}'
fstype: '{{ fstype }}' fstype: '{{ fstype }}'
uuid: '{{ random_uuid }}' uuid: '{{ random_uuid }}'
register: fs_result register: fs_result
- name: "Assert that filesystem creation failed" - name: "Assert that filesystem creation failed"
ansible.builtin.assert: ansible.builtin.assert:
that: fs_result is failed that: fs_result is failed

View file

@ -9,25 +9,25 @@
- fstype != "xfs" - fstype != "xfs"
block: block:
- name: "Generate random UUIDs" - name: "Generate random UUIDs"
ansible.builtin.set_fact: ansible.builtin.set_fact:
random_uuid: '{{ "first_random_uuid" | ansible.builtin.to_uuid }}' random_uuid: '{{ "first_random_uuid" | ansible.builtin.to_uuid }}'
random_uuid2: '{{ "second_random_uuid" | ansible.builtin.to_uuid }}' random_uuid2: '{{ "second_random_uuid" | ansible.builtin.to_uuid }}'
- name: "Create filesystem ({{ fstype }}) with fix UUID as opt" - name: "Create filesystem ({{ fstype }}) with fix UUID as opt"
community.general.filesystem: community.general.filesystem:
dev: '{{ dev }}' dev: '{{ dev }}'
fstype: '{{ fstype }}' fstype: '{{ fstype }}'
opts: "{{ ((fstype == 'lvm') | ansible.builtin.ternary('--norestorefile --uuid ', '-U ')) + random_uuid2 }}" opts: "{{ ((fstype == 'lvm') | ansible.builtin.ternary('--norestorefile --uuid ', '-U ')) + random_uuid2 }}"
uuid: '{{ random_uuid }}' uuid: '{{ random_uuid }}'
register: fs_result2 register: fs_result2
- name: "Get UUID of the created filesystem" - name: "Get UUID of the created filesystem"
ansible.builtin.shell: ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}" cmd: "{{ get_uuid_cmd }}"
changed_when: false changed_when: false
register: uuid2 register: uuid2
- name: "Assert that filesystem UUID is the one set on creation with opt" - name: "Assert that filesystem UUID is the one set on creation with opt"
ansible.builtin.assert: ansible.builtin.assert:
that: (random_uuid2 | replace('-','')) == ( uuid2.stdout | replace('-','')) that: (random_uuid2 | replace('-','')) == ( uuid2.stdout | replace('-',''))

View file

@ -11,8 +11,8 @@ tests:
- {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo} - {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo}
- {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar} - {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar}
result: result:
- {k0_x0: A0, k1_x1: B0} - {k0_x0: A0, k1_x1: B0}
- {k0_x0: A1, k1_x1: B1} - {k0_x0: A1, k1_x1: B1}
- template: mp.j2 - template: mp.j2
group: group:
- {mp: equal, tt: [k0_x0, k1_x1], d: Match keys that equal any of the items in the target.} - {mp: equal, tt: [k0_x0, k1_x1], d: Match keys that equal any of the items in the target.}
@ -24,8 +24,8 @@ tests:
- {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo} - {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo}
- {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar} - {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar}
result: result:
- {k0_x0: A0, k1_x1: B0} - {k0_x0: A0, k1_x1: B0}
- {k0_x0: A1, k1_x1: B1} - {k0_x0: A1, k1_x1: B1}
- template: mp.j2 - template: mp.j2
group: group:
- {mp: equal, tt: k0_x0, d: Match keys that equal the target.} - {mp: equal, tt: k0_x0, d: Match keys that equal the target.}
@ -36,5 +36,5 @@ tests:
- {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo} - {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo}
- {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar} - {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar}
result: result:
- {k0_x0: A0} - {k0_x0: A0}
- {k0_x0: A1} - {k0_x0: A1}

View file

@ -45,15 +45,15 @@
- _bad_random_mac_filter is failed - _bad_random_mac_filter is failed
- "_bad_random_mac_filter.msg is search('Invalid value (.*) for random_mac: 5 colon.* separated items max')" - "_bad_random_mac_filter.msg is search('Invalid value (.*) for random_mac: 5 colon.* separated items max')"
- name: Verify random_mac filter - name: Verify random_mac filter
assert: assert:
that: that:
- "'00' | community.general.random_mac is match('^00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')" - "'00' | community.general.random_mac is match('^00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')"
- "'00:00' | community.general.random_mac is match('^00:00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')" - "'00:00' | community.general.random_mac is match('^00:00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')"
- "'00:00:00' | community.general.random_mac is match('^00:00:00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')" - "'00:00:00' | community.general.random_mac is match('^00:00:00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')"
- "'00:00:00:00' | community.general.random_mac is match('^00:00:00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')" - "'00:00:00:00' | community.general.random_mac is match('^00:00:00:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$')"
- "'00:00:00:00:00' | community.general.random_mac is match('^00:00:00:00:00:[a-f0-9][a-f0-9]$')" - "'00:00:00:00:00' | community.general.random_mac is match('^00:00:00:00:00:[a-f0-9][a-f0-9]$')"
- "'00:00:00' | community.general.random_mac != '00:00:00' | community.general.random_mac" - "'00:00:00' | community.general.random_mac != '00:00:00' | community.general.random_mac"
- name: Verify random_mac filter with seed - name: Verify random_mac filter with seed
assert: assert:

View file

@ -14,8 +14,8 @@ tests:
- {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo} - {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo}
- {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar} - {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar}
result: result:
- {a0: A0, a1: B0, k2_x2: [C0], k3_x3: foo} - {a0: A0, a1: B0, k2_x2: [C0], k3_x3: foo}
- {a0: A1, a1: B1, k2_x2: [C1], k3_x3: bar} - {a0: A1, a1: B1, k2_x2: [C1], k3_x3: bar}
- template: mp.j2 - template: mp.j2
group: group:
- d: Replace keys that starts with any of the attributes before. - d: Replace keys that starts with any of the attributes before.
@ -37,8 +37,8 @@ tests:
- {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo} - {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo}
- {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar} - {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar}
result: result:
- {a0: A0, a1: B0, k2_x2: [C0], k3_x3: foo} - {a0: A0, a1: B0, k2_x2: [C0], k3_x3: foo}
- {a0: A1, a1: B1, k2_x2: [C1], k3_x3: bar} - {a0: A1, a1: B1, k2_x2: [C1], k3_x3: bar}
- template: mp.j2 - template: mp.j2
group: group:
- d: If more keys match the same attribute before the last one will be used. - d: If more keys match the same attribute before the last one will be used.
@ -54,8 +54,8 @@ tests:
- {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo} - {k0_x0: A0, k1_x1: B0, k2_x2: [C0], k3_x3: foo}
- {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar} - {k0_x0: A1, k1_x1: B1, k2_x2: [C1], k3_x3: bar}
result: result:
- X: foo - X: foo
- X: bar - X: bar
- template: mp.j2 - template: mp.j2
group: group:
- d: If there are more matches for a key the first one will be used. - d: If there are more matches for a key the first one will be used.

View file

@ -64,7 +64,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '"abc" is {{ dtype }}' success_msg: '"abc" is {{ dtype }}'
fail_msg: '"abc" is {{ result }}, not {{ dtype }}' fail_msg: '"abc" is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ "abc" | community.general.reveal_ansible_type }}' result: '{{ "abc" | community.general.reveal_ansible_type }}'
@ -74,7 +74,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '123 is {{ dtype }}' success_msg: '123 is {{ dtype }}'
fail_msg: '123 is {{ result }}, not {{ dtype }}' fail_msg: '123 is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ 123 | community.general.reveal_ansible_type }}' result: '{{ 123 | community.general.reveal_ansible_type }}'
@ -84,7 +84,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '123.45 is {{ dtype }}' success_msg: '123.45 is {{ dtype }}'
fail_msg: '123.45 is {{ result }}, not {{ dtype }}' fail_msg: '123.45 is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ 123.45 | community.general.reveal_ansible_type }}' result: '{{ 123.45 | community.general.reveal_ansible_type }}'
@ -94,7 +94,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: 'true is {{ dtype }}' success_msg: 'true is {{ dtype }}'
fail_msg: 'true is {{ result }}, not {{ dtype }}' fail_msg: 'true is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ true | community.general.reveal_ansible_type }}' result: '{{ true | community.general.reveal_ansible_type }}'
@ -104,7 +104,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '["a", "b", "c"] is {{ dtype }}' success_msg: '["a", "b", "c"] is {{ dtype }}'
fail_msg: '["a", "b", "c"] is {{ result }}, not {{ dtype }}' fail_msg: '["a", "b", "c"] is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ ["a", "b", "c"] | community.general.reveal_ansible_type }}' result: '{{ ["a", "b", "c"] | community.general.reveal_ansible_type }}'
@ -114,7 +114,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '[{"a": 1}, {"b": 2}] is {{ dtype }}' success_msg: '[{"a": 1}, {"b": 2}] is {{ dtype }}'
fail_msg: '[{"a": 1}, {"b": 2}] is {{ result }}, not {{ dtype }}' fail_msg: '[{"a": 1}, {"b": 2}] is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ [{"a": 1}, {"b": 2}] | community.general.reveal_ansible_type }}' result: '{{ [{"a": 1}, {"b": 2}] | community.general.reveal_ansible_type }}'
@ -124,7 +124,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '{"a": 1} is {{ dtype }}' success_msg: '{"a": 1} is {{ dtype }}'
fail_msg: '{"a": 1} is {{ result }}, not {{ dtype }}' fail_msg: '{"a": 1} is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ {"a": 1} | community.general.reveal_ansible_type }}' result: '{{ {"a": 1} | community.general.reveal_ansible_type }}'
@ -134,7 +134,7 @@
assert: assert:
that: result == dtype that: result == dtype
success_msg: '{"a": 1, "b": 2} is {{ dtype }}' success_msg: '{"a": 1, "b": 2} is {{ dtype }}'
fail_msg: '{"a": 1, "b": 2} is {{ result }}, not {{ dtype }}' fail_msg: '{"a": 1, "b": 2} is {{ result }}, not {{ dtype }}'
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
result: '{{ {"a": 1, "b": 2} | community.general.reveal_ansible_type }}' result: '{{ {"a": 1, "b": 2} | community.general.reveal_ansible_type }}'
@ -175,7 +175,7 @@
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str", "_AnsibleTaggedInt": "int", "_AnsibleTaggedFloat": "float"} alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str", "_AnsibleTaggedInt": "int", "_AnsibleTaggedFloat": "float"}
data: {'a': 1, 'b': 1.1, 'c': 'abc', 'd': True, 'e': ['x', 'y', 'z'], 'f': {'x': 1, 'y': 2}} data: {'a': 1, 'b': 1.1, 'c': 'abc', 'd': true, 'e': ['x', 'y', 'z'], 'f': {'x': 1, 'y': 2}}
result: '{{ data | community.general.reveal_ansible_type(alias) }}' result: '{{ data | community.general.reveal_ansible_type(alias) }}'
dtype: dict[str, bool|dict|float|int|list|str] dtype: dict[str, bool|dict|float|int|list|str]
@ -187,6 +187,6 @@
quiet: '{{ quiet_test | default(true) | bool }}' quiet: '{{ quiet_test | default(true) | bool }}'
vars: vars:
alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str", "_AnsibleTaggedInt": "int", "_AnsibleTaggedFloat": "float"} alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str", "_AnsibleTaggedInt": "int", "_AnsibleTaggedFloat": "float"}
data: [1, 2, 1.1, 'abc', True, ['x', 'y', 'z'], {'x': 1, 'y': 2}] data: [1, 2, 1.1, 'abc', true, ['x', 'y', 'z'], {'x': 1, 'y': 2}]
result: '{{ data | community.general.reveal_ansible_type(alias) }}' result: '{{ data | community.general.reveal_ansible_type(alias) }}'
dtype: list[bool|dict|float|int|list|str] dtype: list[bool|dict|float|int|list|str]

View file

@ -11,53 +11,53 @@
- block: - block:
- import_tasks: setup.yml - import_tasks: setup.yml
become: true become: true
# executable override # executable override
- name: Test executable override - name: Test executable override
flatpak: flatpak:
name: com.dummy.App1 name: com.dummy.App1
remote: dummy-remote remote: dummy-remote
state: present state: present
executable: nothing-that-exists executable: nothing-that-exists
ignore_errors: true ignore_errors: true
register: executable_override_result register: executable_override_result
- name: Verify executable override test result - name: Verify executable override test result
assert: assert:
that: that:
- executable_override_result is failed - executable_override_result is failed
- executable_override_result is not changed - executable_override_result is not changed
msg: "Specifying non-existing executable shall fail module execution" msg: "Specifying non-existing executable shall fail module execution"
- import_tasks: check_mode.yml - import_tasks: check_mode.yml
become: false become: false
- import_tasks: test.yml - import_tasks: test.yml
become: false become: false
vars: vars:
method: user method: user
- import_tasks: test.yml - import_tasks: test.yml
become: true become: true
vars: vars:
method: system method: system
always: always:
- name: Check HTTP server status - name: Check HTTP server status
async_status: async_status:
jid: "{{ webserver_status.ansible_job_id }}" jid: "{{ webserver_status.ansible_job_id }}"
ignore_errors: true ignore_errors: true
- name: List processes - name: List processes
command: ps aux command: ps aux
- name: Stop HTTP server - name: Stop HTTP server
command: >- command: >-
pkill -f -- '{{ remote_tmp_dir }}/serve.py' pkill -f -- '{{ remote_tmp_dir }}/serve.py'
when: | when: |
ansible_distribution == 'Fedora' or ansible_distribution == 'Fedora' or

View file

@ -11,17 +11,17 @@
when: ansible_distribution == 'Fedora' when: ansible_distribution == 'Fedora'
- block: - block:
- name: Activate flatpak ppa on Ubuntu - name: Activate flatpak ppa on Ubuntu
apt_repository: apt_repository:
repo: ppa:alexlarsson/flatpak repo: ppa:alexlarsson/flatpak
state: present state: present
mode: '0644' mode: '0644'
when: ansible_lsb.major_release | int < 18 when: ansible_lsb.major_release | int < 18
- name: Install flatpak package on Ubuntu - name: Install flatpak package on Ubuntu
apt: apt:
name: flatpak name: flatpak
state: present state: present
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'

View file

@ -164,25 +164,25 @@
- when: url_removal_result is not failed - when: url_removal_result is not failed
block: block:
- name: Verify removal test result - {{ method }} - name: Verify removal test result - {{ method }}
assert: assert:
that: that:
- url_removal_result is changed - url_removal_result is changed
msg: "state=absent with url as name shall remove flatpak when present" msg: "state=absent with url as name shall remove flatpak when present"
- name: Test idempotency of removal with url - {{ method }} - name: Test idempotency of removal with url - {{ method }}
flatpak: flatpak:
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
state: absent state: absent
method: "{{ method }}" method: "{{ method }}"
no_dependencies: true no_dependencies: true
register: double_url_removal_result register: double_url_removal_result
- name: Verify idempotency of removal with url test result - {{ method }} - name: Verify idempotency of removal with url test result - {{ method }}
assert: assert:
that: that:
- double_url_removal_result is not changed - double_url_removal_result is not changed
msg: "state=absent with url as name shall not do anything when flatpak is not present" msg: "state=absent with url as name shall not do anything when flatpak is not present"
- name: Make sure flatpak is really gone - {{ method }} - name: Make sure flatpak is really gone - {{ method }}
flatpak: flatpak:

View file

@ -11,39 +11,39 @@
- block: - block:
- import_tasks: setup.yml - import_tasks: setup.yml
become: true become: true
# executable override # executable override
- name: Test executable override - name: Test executable override
flatpak_remote: flatpak_remote:
name: irrelevant name: irrelevant
remote: irrelevant remote: irrelevant
state: present state: present
executable: nothing-that-exists executable: nothing-that-exists
ignore_errors: true ignore_errors: true
register: executable_override_result register: executable_override_result
- name: Verify executable override test result - name: Verify executable override test result
assert: assert:
that: that:
- executable_override_result is failed - executable_override_result is failed
- executable_override_result is not changed - executable_override_result is not changed
msg: "Specifying non-existing executable shall fail module execution" msg: "Specifying non-existing executable shall fail module execution"
- import_tasks: check_mode.yml - import_tasks: check_mode.yml
become: false become: false
- import_tasks: test.yml - import_tasks: test.yml
become: false become: false
vars: vars:
method: user method: user
- import_tasks: test.yml - import_tasks: test.yml
become: true become: true
vars: vars:
method: system method: system
when: | when: |
ansible_distribution == 'Fedora' or ansible_distribution == 'Fedora' or

View file

@ -9,16 +9,16 @@
state: present state: present
when: ansible_distribution == 'Fedora' when: ansible_distribution == 'Fedora'
- block: - block:
- name: Activate flatpak ppa on Ubuntu versions older than 18.04/bionic - name: Activate flatpak ppa on Ubuntu versions older than 18.04/bionic
apt_repository: apt_repository:
repo: ppa:alexlarsson/flatpak repo: ppa:alexlarsson/flatpak
state: present state: present
mode: '0644' mode: '0644'
when: ansible_lsb.major_release | int < 18 when: ansible_lsb.major_release | int < 18
- name: Install flatpak package on Ubuntu - name: Install flatpak package on Ubuntu
apt: apt:
name: flatpak name: flatpak
state: present state: present
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: Install flatpak remote for testing check mode - name: Install flatpak remote for testing check mode
flatpak_remote: flatpak_remote:

View file

@ -6,32 +6,32 @@
gandi_livedns_domain_name: "ansible-tests.org" gandi_livedns_domain_name: "ansible-tests.org"
gandi_livedns_record_items: gandi_livedns_record_items:
# Single A record # Single A record
- record: test-www - record: test-www
type: A type: A
values: values:
- 10.10.10.10 - 10.10.10.10
ttl: 400 ttl: 400
update_values: update_values:
- 10.10.10.11 - 10.10.10.11
update_ttl: 800 update_ttl: 800
# Multiple A records # Multiple A records
- record: test-www-multiple - record: test-www-multiple
type: A type: A
ttl: 3600 ttl: 3600
values: values:
- 10.10.11.10 - 10.10.11.10
- 10.10.11.10 - 10.10.11.10
update_values: update_values:
- 10.10.11.11 - 10.10.11.11
- 10.10.11.13 - 10.10.11.13
# CNAME # CNAME
- record: test-cname - record: test-cname
type: CNAME type: CNAME
ttl: 10800 ttl: 10800
values: values:
- test-www2 - test-www2
update_values: update_values:
- test-www - test-www

View file

@ -15,7 +15,7 @@
- name: verify test absent dns record - name: verify test absent dns record
assert: assert:
that: that:
- result is successful - result is successful
- name: test create a dns record in check mode - name: test create a dns record in check mode
community.general.gandi_livedns: community.general.gandi_livedns:
@ -30,7 +30,7 @@
- name: verify test create a dns record in check mode - name: verify test create a dns record in check mode
assert: assert:
that: that:
- result is changed - result is changed
- name: test create a dns record - name: test create a dns record
community.general.gandi_livedns: community.general.gandi_livedns:
@ -44,11 +44,11 @@
- name: verify test create a dns record - name: verify test create a dns record
assert: assert:
that: that:
- result is changed - result is changed
- result.record['values'] == item['values'] - result.record['values'] == item['values']
- result.record.record == item.record - result.record.record == item.record
- result.record.type == item.type - result.record.type == item.type
- result.record.ttl == item.ttl - result.record.ttl == item.ttl
- name: test create a dns record idempotence - name: test create a dns record idempotence
community.general.gandi_livedns: community.general.gandi_livedns:
@ -62,11 +62,11 @@
- name: verify test create a dns record idempotence - name: verify test create a dns record idempotence
assert: assert:
that: that:
- result is not changed - result is not changed
- result.record['values'] == item['values'] - result.record['values'] == item['values']
- result.record.record == item.record - result.record.record == item.record
- result.record.type == item.type - result.record.type == item.type
- result.record.ttl == item.ttl - result.record.ttl == item.ttl
- name: test create a DNS record with personal access token - name: test create a DNS record with personal access token
community.general.gandi_livedns: community.general.gandi_livedns:

View file

@ -16,7 +16,7 @@
- name: verify test remove a dns record in check mode - name: verify test remove a dns record in check mode
assert: assert:
that: that:
- result is changed - result is changed
- name: test remove a dns record - name: test remove a dns record
community.general.gandi_livedns: community.general.gandi_livedns:
@ -30,7 +30,7 @@
- name: verify test remove a dns record - name: verify test remove a dns record
assert: assert:
that: that:
- result is changed - result is changed
- name: test remove a dns record idempotence - name: test remove a dns record idempotence
community.general.gandi_livedns: community.general.gandi_livedns:
@ -44,7 +44,7 @@
- name: verify test remove a dns record idempotence - name: verify test remove a dns record idempotence
assert: assert:
that: that:
- result is not changed - result is not changed
- name: test remove second dns record idempotence - name: test remove second dns record idempotence
community.general.gandi_livedns: community.general.gandi_livedns:
@ -58,4 +58,4 @@
- name: verify test remove a dns record idempotence - name: verify test remove a dns record idempotence
assert: assert:
that: that:
- result is not changed - result is not changed

View file

@ -16,11 +16,11 @@
- name: verify test update in check mode - name: verify test update in check mode
assert: assert:
that: that:
- result is changed - result is changed
- result.record['values'] == (item.update_values | default(item['values'])) - result.record['values'] == (item.update_values | default(item['values']))
- result.record.record == item.record - result.record.record == item.record
- result.record.type == item.type - result.record.type == item.type
- result.record.ttl == (item.update_ttl | default(item.ttl)) - result.record.ttl == (item.update_ttl | default(item.ttl))
- name: test update or add another dns record - name: test update or add another dns record
community.general.gandi_livedns: community.general.gandi_livedns:
@ -34,11 +34,11 @@
- name: verify test update a dns record - name: verify test update a dns record
assert: assert:
that: that:
- result is changed - result is changed
- result.record['values'] == (item.update_values | default(item['values'])) - result.record['values'] == (item.update_values | default(item['values']))
- result.record.record == item.record - result.record.record == item.record
- result.record.ttl == (item.update_ttl | default(item.ttl)) - result.record.ttl == (item.update_ttl | default(item.ttl))
- result.record.type == item.type - result.record.type == item.type
- name: test update or add another dns record idempotence - name: test update or add another dns record idempotence
community.general.gandi_livedns: community.general.gandi_livedns:
@ -52,8 +52,8 @@
- name: verify test update a dns record idempotence - name: verify test update a dns record idempotence
assert: assert:
that: that:
- result is not changed - result is not changed
- result.record['values'] == (item.update_values | default(item['values'])) - result.record['values'] == (item.update_values | default(item['values']))
- result.record.record == item.record - result.record.record == item.record
- result.record.ttl == (item.update_ttl | default(item.ttl)) - result.record.ttl == (item.update_ttl | default(item.ttl))
- result.record.type == item.type - result.record.type == item.type

View file

@ -13,202 +13,202 @@
- not (ansible_os_family == 'Alpine') # TODO - not (ansible_os_family == 'Alpine') # TODO
block: block:
- include_vars: '{{ item }}' - include_vars: '{{ item }}'
with_first_found: with_first_found:
- files: - files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml' - '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_distribution }}.yml' - '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml' - '{{ ansible_os_family }}.yml'
- 'default.yml' - 'default.yml'
paths: '../vars' paths: '../vars'
- name: Install dependencies for test - name: Install dependencies for test
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
loop: "{{ test_packages }}" loop: "{{ test_packages }}"
when: ansible_distribution != "MacOSX" when: ansible_distribution != "MacOSX"
- name: Install a gem - name: Install a gem
gem:
name: gist
state: present
register: install_gem_result
ignore_errors: true
# when running as root on Fedora, '--install-dir' is set in the os defaults which is
# incompatible with '--user-install', we ignore this error for this case only
- name: fail if failed to install gem
fail:
msg: "failed to install gem: {{ install_gem_result.msg }}"
when:
- install_gem_result is failed
- not (ansible_user_uid == 0 and "User --install-dir or --user-install but not both" not in install_gem_result.msg)
- block:
- name: List gems
command: gem list
register: current_gems
- name: Ensure gem was installed
assert:
that:
- install_gem_result is changed
- current_gems.stdout is search('gist\s+\([0-9.]+\)')
- name: Remove a gem
gem: gem:
name: gist name: gist
state: absent state: present
register: remove_gem_results register: install_gem_result
ignore_errors: true
- name: List gems # when running as root on Fedora, '--install-dir' is set in the os defaults which is
command: gem list # incompatible with '--user-install', we ignore this error for this case only
register: current_gems - name: fail if failed to install gem
fail:
msg: "failed to install gem: {{ install_gem_result.msg }}"
when:
- install_gem_result is failed
- not (ansible_user_uid == 0 and "User --install-dir or --user-install but not both" not in install_gem_result.msg)
- name: Verify gem is not installed - block:
- name: List gems
command: gem list
register: current_gems
- name: Ensure gem was installed
assert:
that:
- install_gem_result is changed
- current_gems.stdout is search('gist\s+\([0-9.]+\)')
- name: Remove a gem
gem:
name: gist
state: absent
register: remove_gem_results
- name: List gems
command: gem list
register: current_gems
- name: Verify gem is not installed
assert:
that:
- remove_gem_results is changed
- current_gems.stdout is not search('gist\s+\([0-9.]+\)')
when: not install_gem_result is failed
# install gem in --no-user-install
- block:
- name: Install a gem with --no-user-install
gem:
name: gist
state: present
user_install: false
register: install_gem_result
- name: List gems
command: gem list
register: current_gems
- name: Ensure gem was installed
assert:
that:
- install_gem_result is changed
- current_gems.stdout is search('gist\s+\([0-9.]+\)')
- name: Remove a gem
gem:
name: gist
state: absent
register: remove_gem_results
- name: List gems
command: gem list
register: current_gems
- name: Verify gem is not installed
assert:
that:
- remove_gem_results is changed
- current_gems.stdout is not search('gist\s+\([0-9.]+\)')
when: ansible_user_uid == 0
# Check custom gem directory
- name: Install gem in a custom directory with incorrect options
gem:
name: gist
state: present
install_dir: "{{ remote_tmp_dir }}/gems"
ignore_errors: true
register: install_gem_fail_result
- debug:
var: install_gem_fail_result
tags: debug
- name: Ensure previous task failed
assert: assert:
that: that:
- remove_gem_results is changed - install_gem_fail_result is failed
- current_gems.stdout is not search('gist\s+\([0-9.]+\)') - install_gem_fail_result.msg == 'install_dir requires user_install=false'
when: not install_gem_result is failed
# install gem in --no-user-install - name: Install a gem in a custom directory
- block:
- name: Install a gem with --no-user-install
gem: gem:
name: gist name: gist
state: present state: present
user_install: false user_install: false
install_dir: "{{ remote_tmp_dir }}/gems"
register: install_gem_result register: install_gem_result
- name: List gems - name: Find gems in custom directory
command: gem list find:
register: current_gems paths: "{{ remote_tmp_dir }}/gems/gems"
file_type: directory
contains: gist
register: gem_search
- name: Ensure gem was installed - name: Ensure gem was installed in custom directory
assert: assert:
that: that:
- install_gem_result is changed - install_gem_result is changed
- current_gems.stdout is search('gist\s+\([0-9.]+\)') - gem_search.files[0].path is search('gist-[0-9.]+')
ignore_errors: true
- name: Remove a gem - name: Remove a gem in a custom directory
gem: gem:
name: gist name: gist
state: absent state: absent
register: remove_gem_results user_install: false
install_dir: "{{ remote_tmp_dir }}/gems"
register: install_gem_result
- name: List gems - name: Find gems in custom directory
command: gem list find:
register: current_gems paths: "{{ remote_tmp_dir }}/gems/gems"
file_type: directory
contains: gist
register: gem_search
- name: Verify gem is not installed - name: Ensure gem was removed in custom directory
assert: assert:
that: that:
- remove_gem_results is changed - install_gem_result is changed
- current_gems.stdout is not search('gist\s+\([0-9.]+\)') - gem_search.files | length == 0
when: ansible_user_uid == 0
# Check custom gem directory # Custom directory for executables (--bindir)
- name: Install gem in a custom directory with incorrect options - name: Install gem with custom bindir
gem: gem:
name: gist name: gist
state: present state: present
install_dir: "{{ remote_tmp_dir }}/gems" bindir: "{{ remote_tmp_dir }}/custom_bindir"
ignore_errors: true norc: true
register: install_gem_fail_result user_install: false # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
register: install_gem_result
- debug: - name: Get stats of gem executable
var: install_gem_fail_result stat:
tags: debug path: "{{ remote_tmp_dir }}/custom_bindir/gist"
register: gem_bindir_stat
- name: Ensure previous task failed - name: Ensure gem executable was installed in custom directory
assert: assert:
that: that:
- install_gem_fail_result is failed - install_gem_result is changed
- install_gem_fail_result.msg == 'install_dir requires user_install=false' - gem_bindir_stat.stat.exists and gem_bindir_stat.stat.isreg
- name: Install a gem in a custom directory - name: Remove gem with custom bindir
gem: gem:
name: gist name: gist
state: present state: absent
user_install: false bindir: "{{ remote_tmp_dir }}/custom_bindir"
install_dir: "{{ remote_tmp_dir }}/gems" norc: true
register: install_gem_result user_install: false # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
register: install_gem_result
- name: Find gems in custom directory - name: Get stats of gem executable
find: stat:
paths: "{{ remote_tmp_dir }}/gems/gems" path: "{{ remote_tmp_dir }}/custom_bindir/gist"
file_type: directory register: gem_bindir_stat
contains: gist
register: gem_search
- name: Ensure gem was installed in custom directory - name: Ensure gem executable was removed from custom directory
assert: assert:
that: that:
- install_gem_result is changed - install_gem_result is changed
- gem_search.files[0].path is search('gist-[0-9.]+') - not gem_bindir_stat.stat.exists
ignore_errors: true
- name: Remove a gem in a custom directory
gem:
name: gist
state: absent
user_install: false
install_dir: "{{ remote_tmp_dir }}/gems"
register: install_gem_result
- name: Find gems in custom directory
find:
paths: "{{ remote_tmp_dir }}/gems/gems"
file_type: directory
contains: gist
register: gem_search
- name: Ensure gem was removed in custom directory
assert:
that:
- install_gem_result is changed
- gem_search.files | length == 0
# Custom directory for executables (--bindir)
- name: Install gem with custom bindir
gem:
name: gist
state: present
bindir: "{{ remote_tmp_dir }}/custom_bindir"
norc: true
user_install: false # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
register: install_gem_result
- name: Get stats of gem executable
stat:
path: "{{ remote_tmp_dir }}/custom_bindir/gist"
register: gem_bindir_stat
- name: Ensure gem executable was installed in custom directory
assert:
that:
- install_gem_result is changed
- gem_bindir_stat.stat.exists and gem_bindir_stat.stat.isreg
- name: Remove gem with custom bindir
gem:
name: gist
state: absent
bindir: "{{ remote_tmp_dir }}/custom_bindir"
norc: true
user_install: false # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
register: install_gem_result
- name: Get stats of gem executable
stat:
path: "{{ remote_tmp_dir }}/custom_bindir/gist"
register: gem_bindir_stat
- name: Ensure gem executable was removed from custom directory
assert:
that:
- install_gem_result is changed
- not gem_bindir_stat.stat.exists

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
#- import_tasks: setup_no_value.yml # - import_tasks: setup_no_value.yml
- name: setting value - name: setting value
git_config: git_config:

View file

@ -15,18 +15,27 @@
- block: - block:
- include_tasks: get_simple_value.yml - include_tasks: get_simple_value.yml
loop: loop:
- { import_file: setup_global.yml, git_scope: 'global' } - import_file: setup_global.yml
- { import_file: setup_file.yml, git_scope: 'file', git_file: "{{ remote_tmp_dir }}/gitconfig_file" } git_scope: 'global'
- import_file: setup_file.yml
git_scope: 'file'
git_file: "{{ remote_tmp_dir }}/gitconfig_file"
- include_tasks: get_multi_value.yml - include_tasks: get_multi_value.yml
loop: loop:
- { import_file: setup_global.yml, git_scope: 'global' } - import_file: setup_global.yml
- { import_file: setup_file.yml, git_scope: 'file', git_file: "{{ remote_tmp_dir }}/gitconfig_file" } git_scope: 'global'
- import_file: setup_file.yml
git_scope: 'file'
git_file: "{{ remote_tmp_dir }}/gitconfig_file"
- include_tasks: get_all_values.yml - include_tasks: get_all_values.yml
loop: loop:
- { import_file: setup_global.yml, git_scope: 'global' } - import_file: setup_global.yml
- { import_file: setup_file.yml, git_scope: 'file', git_file: "{{ remote_tmp_dir }}/gitconfig_file" } git_scope: 'global'
- import_file: setup_file.yml
git_scope: 'file'
git_file: "{{ remote_tmp_dir }}/gitconfig_file"
- include_tasks: error_handling.yml - include_tasks: error_handling.yml
when: git_installed is succeeded and git_version.stdout is version(git_version_supporting_includes, ">=") when: git_installed is succeeded and git_version.stdout is version(git_version_supporting_includes, ">=")

View file

@ -12,7 +12,7 @@
- name: Install JWT - name: Install JWT
ansible.builtin.pip: ansible.builtin.pip:
name: name:
- jwt - jwt
- name: Read file - name: Read file
ansible.builtin.set_fact: ansible.builtin.set_fact:
@ -26,5 +26,5 @@
- assert: - assert:
that: that:
- github_app_access_token is failed - github_app_access_token is failed
- '"Github return error" in github_app_access_token.msg' - '"Github return error" in github_app_access_token.msg'

View file

@ -25,8 +25,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: create_pfail_token_status register: create_pfail_token_status
always: always:
- name: Assert that token creation in nonexisting group failed - name: Assert that token creation in nonexisting group failed
@ -47,8 +47,8 @@
expires_at: '2025-13-01' expires_at: '2025-13-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: create_efail_token_status register: create_efail_token_status
always: always:
- name: Assert that token creation with invalid expires_at failed - name: Assert that token creation with invalid expires_at failed
@ -68,8 +68,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: create_token_status register: create_token_status
- name: Assert that token creation with valid arguments is successfull - name: Assert that token creation with valid arguments is successfull
assert: assert:
@ -88,8 +88,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: check_token_status register: check_token_status
- name: Assert that token creation without changes and recreate=never succeeds with status not changed - name: Assert that token creation without changes and recreate=never succeeds with status not changed
assert: assert:
@ -108,8 +108,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
recreate: state_change recreate: state_change
register: check_recreate_token_status register: check_recreate_token_status
- name: Assert that token creation without changes and recreate=state_change succeeds with status not changed - name: Assert that token creation without changes and recreate=state_change succeeds with status not changed
@ -130,8 +130,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: change_token_status register: change_token_status
always: always:
- name: Assert that token change with recreate=never fails - name: Assert that token change with recreate=never fails
@ -151,8 +151,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
recreate: state_change recreate: state_change
register: change_recreate_token_status register: change_recreate_token_status
- name: Assert that token change with recreate=state_change succeeds - name: Assert that token change with recreate=state_change succeeds
@ -172,8 +172,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
recreate: always recreate: always
register: change_recreate1_token_status register: change_recreate1_token_status
- name: Assert that token change with recreate=always succeeds - name: Assert that token change with recreate=always succeeds
@ -193,8 +193,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: revoke_token_status register: revoke_token_status
- name: Assert that token revocation succeeds - name: Assert that token revocation succeeds
assert: assert:
@ -212,8 +212,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: revoke_token_status register: revoke_token_status
- name: Assert that token revocation succeeds with status not changed - name: Assert that token revocation succeeds with status not changed
assert: assert:

View file

@ -438,7 +438,7 @@
- gitlab_instance_variable_state.instance_variable.removed|length == 0 - gitlab_instance_variable_state.instance_variable.removed|length == 0
- gitlab_instance_variable_state.instance_variable.updated|length == 0 - gitlab_instance_variable_state.instance_variable.updated|length == 0
# VALUE_SPECIFIED_IN_NO_LOG_PARAMETER # VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#- gitlab_instance_variable_state.instance_variable.added[0] == "my_test_var" # - gitlab_instance_variable_state.instance_variable.added[0] == "my_test_var"
- name: change variable_type attribute - name: change variable_type attribute
gitlab_instance_variable: gitlab_instance_variable:

View file

@ -14,137 +14,137 @@
state: present state: present
- block: - block:
- name: Create {{ gitlab_project_name }} project - name: Create {{ gitlab_project_name }} project
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
default_branch: "{{ gitlab_branch }}" default_branch: "{{ gitlab_branch }}"
initialize_with_readme: true initialize_with_readme: true
state: present state: present
- name: Create Issue - name: Create Issue
gitlab_issue: gitlab_issue:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
description: "Test description" description: "Test description"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
state: present state: present
title: "Ansible test issue" title: "Ansible test issue"
register: gitlab_issue_create register: gitlab_issue_create
- name: Test Issue Created - name: Test Issue Created
assert: assert:
that: that:
- gitlab_issue_create is changed - gitlab_issue_create is changed
- name: Create Issue ( Idempotency test ) - name: Create Issue ( Idempotency test )
gitlab_issue: gitlab_issue:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
description: "Test description" description: "Test description"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
state: present state: present
title: "Ansible test issue" title: "Ansible test issue"
register: gitlab_issue_create_idempotence register: gitlab_issue_create_idempotence
- name: Test Create Issue is Idempotent - name: Test Create Issue is Idempotent
assert: assert:
that: that:
- gitlab_issue_create_idempotence is not changed - gitlab_issue_create_idempotence is not changed
- name: Update Issue Test ( Additions ) - name: Update Issue Test ( Additions )
gitlab_issue: gitlab_issue:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
assignee_ids: "{{ gitlab_assignee_ids }}" assignee_ids: "{{ gitlab_assignee_ids }}"
description_path: "{{ gitlab_description_path }}" description_path: "{{ gitlab_description_path }}"
labels: "{{ gitlab_labels }}" labels: "{{ gitlab_labels }}"
milestone_search: "{{ gitlab_milestone_search }}" milestone_search: "{{ gitlab_milestone_search }}"
milestone_group_id: "{{ gitlab_milestone_group_id }}" milestone_group_id: "{{ gitlab_milestone_group_id }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
state: present state: present
title: "Ansible test issue" title: "Ansible test issue"
register: gitlab_issue_update_additions register: gitlab_issue_update_additions
- name: Test Issue Updated ( Additions ) - name: Test Issue Updated ( Additions )
assert: assert:
that: that:
- gitlab_issue_update_additions.issue.labels[0] == "{{ gitlab_labels[0] }}" - gitlab_issue_update_additions.issue.labels[0] == "{{ gitlab_labels[0] }}"
- gitlab_issue_update_additions.issue.assignees[0].username == "{{ gitlab_assignee_ids[0] }}" - gitlab_issue_update_additions.issue.assignees[0].username == "{{ gitlab_assignee_ids[0] }}"
- "'### Description\n\nIssue test description' in gitlab_issue_update_additions.issue.description" - "'### Description\n\nIssue test description' in gitlab_issue_update_additions.issue.description"
- gitlab_issue_update_additions.issue.milestone.title == "{{ gitlab_milestone_search }}" - gitlab_issue_update_additions.issue.milestone.title == "{{ gitlab_milestone_search }}"
- name: Update Issue Test ( Persistence ) - name: Update Issue Test ( Persistence )
gitlab_issue: gitlab_issue:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
description_path: "{{ gitlab_description_path }}" description_path: "{{ gitlab_description_path }}"
milestone_search: "{{ gitlab_milestone_search }}" milestone_search: "{{ gitlab_milestone_search }}"
milestone_group_id: "{{ gitlab_milestone_group_id }}" milestone_group_id: "{{ gitlab_milestone_group_id }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
state: present state: present
title: "Ansible test issue" title: "Ansible test issue"
register: gitlab_issue_update_persistence register: gitlab_issue_update_persistence
- name: Test issue Not Updated ( Persistence ) - name: Test issue Not Updated ( Persistence )
assert: assert:
that: that:
- gitlab_issue_update_persistence.issue.labels[0] == "{{ gitlab_labels[0] }}" - gitlab_issue_update_persistence.issue.labels[0] == "{{ gitlab_labels[0] }}"
- gitlab_issue_update_persistence.issue.assignees[0].username == "{{ gitlab_assignee_ids[0] }}" - gitlab_issue_update_persistence.issue.assignees[0].username == "{{ gitlab_assignee_ids[0] }}"
- name: Update Issue Test ( Removals ) - name: Update Issue Test ( Removals )
gitlab_issue: gitlab_issue:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
assignee_ids: [] assignee_ids: []
description_path: "{{ gitlab_description_path }}" description_path: "{{ gitlab_description_path }}"
labels: [] labels: []
milestone_search: "" milestone_search: ""
milestone_group_id: "" milestone_group_id: ""
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
state: present state: present
title: "Ansible test issue" title: "Ansible test issue"
register: gitlab_issue_update_removal register: gitlab_issue_update_removal
- name: Test issue updated - name: Test issue updated
assert: assert:
that: that:
- gitlab_issue_update_removal.issue.labels == [] - gitlab_issue_update_removal.issue.labels == []
- gitlab_issue_update_removal.issue.assignees == [] - gitlab_issue_update_removal.issue.assignees == []
- gitlab_issue_update_removal.issue.milestone == None - gitlab_issue_update_removal.issue.milestone == None
- name: Delete Issue - name: Delete Issue
gitlab_issue: gitlab_issue:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
title: "Ansible test issue" title: "Ansible test issue"
state: absent state: absent
register: gitlab_issue_delete register: gitlab_issue_delete
- name: Test issue is deleted - name: Test issue is deleted
assert: assert:
that: that:
- gitlab_issue_delete is changed - gitlab_issue_delete is changed
always: always:
- name: Delete Issue - name: Delete Issue
gitlab_issue: gitlab_issue:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
title: "Ansible test issue" title: "Ansible test issue"
state_filter: "opened" state_filter: "opened"
state: absent state: absent
register: gitlab_issue_delete register: gitlab_issue_delete
- name: Clean up {{ gitlab_project_name }} - name: Clean up {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: false validate_certs: false
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
state: absent state: absent

View file

@ -14,450 +14,450 @@
state: present state: present
- block: - block:
### ###
### Group label ### Group label
### ###
- name: Create {{ gitlab_project_group }} - name: Create {{ gitlab_project_group }}
gitlab_group: gitlab_group:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_group }}" name: "{{ gitlab_project_group }}"
state: present state: present
- name: Purge all group labels for check_mode test - name: Purge all group labels for check_mode test
gitlab_label: gitlab_label:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
purge: true purge: true
- name: Group label - Add a label in check_mode - name: Group label - Add a label in check_mode
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
check_mode: true check_mode: true
register: gitlab_group_label_state register: gitlab_group_label_state
- name: Group label - Check_mode state must be changed - name: Group label - Check_mode state must be changed
assert: assert:
that: that:
- gitlab_group_label_state is changed - gitlab_group_label_state is changed
- name: Group label - Create label {{ gitlab_first_label }} and {{ gitlab_second_label }} - name: Group label - Create label {{ gitlab_first_label }} and {{ gitlab_second_label }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
color: "{{ gitlab_first_label_color }}" color: "{{ gitlab_first_label_color }}"
description: "{{ gitlab_first_label_description }}" description: "{{ gitlab_first_label_description }}"
priority: "{{ gitlab_first_label_priority }}" priority: "{{ gitlab_first_label_priority }}"
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
state: present state: present
register: gitlab_group_label_create register: gitlab_group_label_create
- name: Group label - Test Label Created - name: Group label - Test Label Created
assert: assert:
that: that:
- gitlab_group_label_create is changed - gitlab_group_label_create is changed
- gitlab_group_label_create.labels.added|length == 2 - gitlab_group_label_create.labels.added|length == 2
- gitlab_group_label_create.labels.untouched|length == 0 - gitlab_group_label_create.labels.untouched|length == 0
- gitlab_group_label_create.labels.removed|length == 0 - gitlab_group_label_create.labels.removed|length == 0
- gitlab_group_label_create.labels.updated|length == 0 - gitlab_group_label_create.labels.updated|length == 0
- gitlab_group_label_create.labels.added[0] == "{{ gitlab_first_label }}" - gitlab_group_label_create.labels.added[0] == "{{ gitlab_first_label }}"
- gitlab_group_label_create.labels.added[1] == "{{ gitlab_second_label }}" - gitlab_group_label_create.labels.added[1] == "{{ gitlab_second_label }}"
- name: Group label - Create Label ( Idempotency test ) - name: Group label - Create Label ( Idempotency test )
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
color: "{{ gitlab_first_label_color }}" color: "{{ gitlab_first_label_color }}"
description: "{{ gitlab_first_label_description }}" description: "{{ gitlab_first_label_description }}"
priority: "{{ gitlab_first_label_priority }}" priority: "{{ gitlab_first_label_priority }}"
state: present state: present
register: gitlab_group_label_create_idempotence register: gitlab_group_label_create_idempotence
- name: Group label - Test Create Label is Idempotent - name: Group label - Test Create Label is Idempotent
assert: assert:
that: that:
- gitlab_group_label_create_idempotence is not changed - gitlab_group_label_create_idempotence is not changed
- name: Group label - Update Label {{ gitlab_first_label }} changing color - name: Group label - Update Label {{ gitlab_first_label }} changing color
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
state: present state: present
register: gitlab_group_label_update register: gitlab_group_label_update
- name: Group label - Test Label Updated - name: Group label - Test Label Updated
assert: assert:
that: that:
- gitlab_group_label_update.labels.added|length == 0 - gitlab_group_label_update.labels.added|length == 0
- gitlab_group_label_update.labels.untouched|length == 0 - gitlab_group_label_update.labels.untouched|length == 0
- gitlab_group_label_update.labels.removed|length == 0 - gitlab_group_label_update.labels.removed|length == 0
- gitlab_group_label_update.labels.updated|length == 1 - gitlab_group_label_update.labels.updated|length == 1
- gitlab_group_label_update.labels.updated[0] == "{{ gitlab_first_label }}" - gitlab_group_label_update.labels.updated[0] == "{{ gitlab_first_label }}"
- name: Group label - Change label {{ gitlab_second_label }} name to {{ gitlab_second_label_new_name }} - name: Group label - Change label {{ gitlab_second_label }} name to {{ gitlab_second_label_new_name }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
new_name: "{{ gitlab_second_label_new_name }}" new_name: "{{ gitlab_second_label_new_name }}"
state: present state: present
register: gitlab_group_label_new_name register: gitlab_group_label_new_name
- name: Group label - Test Label name changed - name: Group label - Test Label name changed
assert: assert:
that: that:
- gitlab_group_label_new_name.labels.added|length == 0 - gitlab_group_label_new_name.labels.added|length == 0
- gitlab_group_label_new_name.labels.untouched|length == 0 - gitlab_group_label_new_name.labels.untouched|length == 0
- gitlab_group_label_new_name.labels.removed|length == 0 - gitlab_group_label_new_name.labels.removed|length == 0
- gitlab_group_label_new_name.labels.updated|length == 1 - gitlab_group_label_new_name.labels.updated|length == 1
- gitlab_group_label_new_name.labels.updated[0] == "{{ gitlab_second_label }}" - gitlab_group_label_new_name.labels.updated[0] == "{{ gitlab_second_label }}"
- name: Group label - Change label name back to {{ gitlab_second_label }} - name: Group label - Change label name back to {{ gitlab_second_label }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_second_label_new_name }}" - name: "{{ gitlab_second_label_new_name }}"
new_name: "{{ gitlab_second_label }}" new_name: "{{ gitlab_second_label }}"
state: present state: present
register: gitlab_group_label_orig_name register: gitlab_group_label_orig_name
- name: Group label - Test Label name changed back - name: Group label - Test Label name changed back
assert: assert:
that: that:
- gitlab_group_label_orig_name.labels.added|length == 0 - gitlab_group_label_orig_name.labels.added|length == 0
- gitlab_group_label_orig_name.labels.untouched|length == 0 - gitlab_group_label_orig_name.labels.untouched|length == 0
- gitlab_group_label_orig_name.labels.removed|length == 0 - gitlab_group_label_orig_name.labels.removed|length == 0
- gitlab_group_label_orig_name.labels.updated|length == 1 - gitlab_group_label_orig_name.labels.updated|length == 1
- gitlab_group_label_orig_name.labels.updated[0] == "{{ gitlab_second_label_new_name }}" - gitlab_group_label_orig_name.labels.updated[0] == "{{ gitlab_second_label_new_name }}"
- name: Group label - Update Label Test ( Additions ) - name: Group label - Update Label Test ( Additions )
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
description: "{{ gitlab_first_label_description }}" description: "{{ gitlab_first_label_description }}"
priority: "{{ gitlab_first_label_priority }}" priority: "{{ gitlab_first_label_priority }}"
state: present state: present
register: gitlab_group_label_update_additions register: gitlab_group_label_update_additions
- name: Group label - Test Label Updated ( Additions ) - name: Group label - Test Label Updated ( Additions )
assert: assert:
that: that:
- gitlab_group_label_update_additions.labels.added|length == 0 - gitlab_group_label_update_additions.labels.added|length == 0
- gitlab_group_label_update_additions.labels.untouched|length == 0 - gitlab_group_label_update_additions.labels.untouched|length == 0
- gitlab_group_label_update_additions.labels.removed|length == 0 - gitlab_group_label_update_additions.labels.removed|length == 0
- gitlab_group_label_update_additions.labels.updated|length == 1 - gitlab_group_label_update_additions.labels.updated|length == 1
- gitlab_group_label_update_additions.labels.updated[0] == "{{ gitlab_second_label }}" - gitlab_group_label_update_additions.labels.updated[0] == "{{ gitlab_second_label }}"
- name: Group label - Delete Label {{ gitlab_second_label }} - name: Group label - Delete Label {{ gitlab_second_label }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
state: absent state: absent
register: gitlab_group_label_delete register: gitlab_group_label_delete
- name: Group label - Test label is deleted - name: Group label - Test label is deleted
assert: assert:
that: that:
- gitlab_group_label_delete is changed - gitlab_group_label_delete is changed
- gitlab_group_label_delete.labels.added|length == 0 - gitlab_group_label_delete.labels.added|length == 0
- gitlab_group_label_delete.labels.untouched|length == 0 - gitlab_group_label_delete.labels.untouched|length == 0
- gitlab_group_label_delete.labels.removed|length == 1 - gitlab_group_label_delete.labels.removed|length == 1
- gitlab_group_label_delete.labels.updated|length == 0 - gitlab_group_label_delete.labels.updated|length == 0
- gitlab_group_label_delete.labels.removed[0] == "{{ gitlab_second_label }}" - gitlab_group_label_delete.labels.removed[0] == "{{ gitlab_second_label }}"
- name: Group label - Create label {{ gitlab_second_label }} again purging the other - name: Group label - Create label {{ gitlab_second_label }} again purging the other
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
purge: true purge: true
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
state: present state: present
register: gitlab_group_label_create_purging register: gitlab_group_label_create_purging
- name: Group label - Test Label Created again - name: Group label - Test Label Created again
assert: assert:
that: that:
- gitlab_group_label_create_purging is changed - gitlab_group_label_create_purging is changed
- gitlab_group_label_create_purging.labels.added|length == 1 - gitlab_group_label_create_purging.labels.added|length == 1
- gitlab_group_label_create_purging.labels.untouched|length == 0 - gitlab_group_label_create_purging.labels.untouched|length == 0
- gitlab_group_label_create_purging.labels.removed|length == 1 - gitlab_group_label_create_purging.labels.removed|length == 1
- gitlab_group_label_create_purging.labels.updated|length == 0 - gitlab_group_label_create_purging.labels.updated|length == 0
- gitlab_group_label_create_purging.labels.added[0] == "{{ gitlab_second_label }}" - gitlab_group_label_create_purging.labels.added[0] == "{{ gitlab_second_label }}"
- gitlab_group_label_create_purging.labels.removed[0] == "{{ gitlab_first_label }}" - gitlab_group_label_create_purging.labels.removed[0] == "{{ gitlab_first_label }}"
### ###
### Project label ### Project label
### ###
- name: Create {{ gitlab_project_name }} - name: Create {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
default_branch: "{{ gitlab_branch }}" default_branch: "{{ gitlab_branch }}"
initialize_with_readme: true initialize_with_readme: true
state: present state: present
- name: Purge all labels for check_mode test - name: Purge all labels for check_mode test
gitlab_label: gitlab_label:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
purge: true purge: true
- name: Add a label in check_mode - name: Add a label in check_mode
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
check_mode: true check_mode: true
register: gitlab_first_label_state register: gitlab_first_label_state
- name: Check_mode state must be changed - name: Check_mode state must be changed
assert: assert:
that: that:
- gitlab_first_label_state is changed - gitlab_first_label_state is changed
- name: Create label {{ gitlab_first_label }} and {{ gitlab_second_label }} - name: Create label {{ gitlab_first_label }} and {{ gitlab_second_label }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
color: "{{ gitlab_first_label_color }}" color: "{{ gitlab_first_label_color }}"
description: "{{ gitlab_first_label_description }}" description: "{{ gitlab_first_label_description }}"
priority: "{{ gitlab_first_label_priority }}" priority: "{{ gitlab_first_label_priority }}"
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
state: present state: present
register: gitlab_first_label_create register: gitlab_first_label_create
- name: Test Label Created - name: Test Label Created
assert: assert:
that: that:
- gitlab_first_label_create is changed - gitlab_first_label_create is changed
- gitlab_first_label_create.labels.added|length == 2 - gitlab_first_label_create.labels.added|length == 2
- gitlab_first_label_create.labels.untouched|length == 0 - gitlab_first_label_create.labels.untouched|length == 0
- gitlab_first_label_create.labels.removed|length == 0 - gitlab_first_label_create.labels.removed|length == 0
- gitlab_first_label_create.labels.updated|length == 0 - gitlab_first_label_create.labels.updated|length == 0
- gitlab_first_label_create.labels.added[0] == "{{ gitlab_first_label }}" - gitlab_first_label_create.labels.added[0] == "{{ gitlab_first_label }}"
- gitlab_first_label_create.labels.added[1] == "{{ gitlab_second_label }}" - gitlab_first_label_create.labels.added[1] == "{{ gitlab_second_label }}"
- name: Create Label ( Idempotency test ) - name: Create Label ( Idempotency test )
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
color: "{{ gitlab_first_label_color }}" color: "{{ gitlab_first_label_color }}"
description: "{{ gitlab_first_label_description }}" description: "{{ gitlab_first_label_description }}"
priority: "{{ gitlab_first_label_priority }}" priority: "{{ gitlab_first_label_priority }}"
state: present state: present
register: gitlab_first_label_create_idempotence register: gitlab_first_label_create_idempotence
- name: Test Create Label is Idempotent - name: Test Create Label is Idempotent
assert: assert:
that: that:
- gitlab_first_label_create_idempotence is not changed - gitlab_first_label_create_idempotence is not changed
- name: Update Label {{ gitlab_first_label }} changing color - name: Update Label {{ gitlab_first_label }} changing color
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
state: present state: present
register: gitlab_first_label_update register: gitlab_first_label_update
- name: Test Label Updated - name: Test Label Updated
assert: assert:
that: that:
- gitlab_first_label_update.labels.added|length == 0 - gitlab_first_label_update.labels.added|length == 0
- gitlab_first_label_update.labels.untouched|length == 0 - gitlab_first_label_update.labels.untouched|length == 0
- gitlab_first_label_update.labels.removed|length == 0 - gitlab_first_label_update.labels.removed|length == 0
- gitlab_first_label_update.labels.updated|length == 1 - gitlab_first_label_update.labels.updated|length == 1
- gitlab_first_label_update.labels.updated[0] == "{{ gitlab_first_label }}" - gitlab_first_label_update.labels.updated[0] == "{{ gitlab_first_label }}"
- name: Change label {{ gitlab_second_label }} name to {{ gitlab_second_label_new_name }} - name: Change label {{ gitlab_second_label }} name to {{ gitlab_second_label_new_name }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
new_name: "{{ gitlab_second_label_new_name }}" new_name: "{{ gitlab_second_label_new_name }}"
state: present state: present
register: gitlab_first_label_new_name register: gitlab_first_label_new_name
- name: Test Label name changed - name: Test Label name changed
assert: assert:
that: that:
- gitlab_first_label_new_name.labels.added|length == 0 - gitlab_first_label_new_name.labels.added|length == 0
- gitlab_first_label_new_name.labels.untouched|length == 0 - gitlab_first_label_new_name.labels.untouched|length == 0
- gitlab_first_label_new_name.labels.removed|length == 0 - gitlab_first_label_new_name.labels.removed|length == 0
- gitlab_first_label_new_name.labels.updated|length == 1 - gitlab_first_label_new_name.labels.updated|length == 1
- gitlab_first_label_new_name.labels.updated[0] == "{{ gitlab_second_label }}" - gitlab_first_label_new_name.labels.updated[0] == "{{ gitlab_second_label }}"
- name: Change label name back to {{ gitlab_second_label }} - name: Change label name back to {{ gitlab_second_label }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_second_label_new_name }}" - name: "{{ gitlab_second_label_new_name }}"
new_name: "{{ gitlab_second_label }}" new_name: "{{ gitlab_second_label }}"
state: present state: present
register: gitlab_first_label_orig_name register: gitlab_first_label_orig_name
- name: Test Label name changed back - name: Test Label name changed back
assert: assert:
that: that:
- gitlab_first_label_orig_name.labels.added|length == 0 - gitlab_first_label_orig_name.labels.added|length == 0
- gitlab_first_label_orig_name.labels.untouched|length == 0 - gitlab_first_label_orig_name.labels.untouched|length == 0
- gitlab_first_label_orig_name.labels.removed|length == 0 - gitlab_first_label_orig_name.labels.removed|length == 0
- gitlab_first_label_orig_name.labels.updated|length == 1 - gitlab_first_label_orig_name.labels.updated|length == 1
- gitlab_first_label_orig_name.labels.updated[0] == "{{ gitlab_second_label_new_name }}" - gitlab_first_label_orig_name.labels.updated[0] == "{{ gitlab_second_label_new_name }}"
- name: Update Label Test ( Additions ) - name: Update Label Test ( Additions )
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
description: "{{ gitlab_first_label_description }}" description: "{{ gitlab_first_label_description }}"
priority: "{{ gitlab_first_label_priority }}" priority: "{{ gitlab_first_label_priority }}"
state: present state: present
register: gitlab_first_label_update_additions register: gitlab_first_label_update_additions
- name: Test Label Updated ( Additions ) - name: Test Label Updated ( Additions )
assert: assert:
that: that:
- gitlab_first_label_update_additions.labels.added|length == 0 - gitlab_first_label_update_additions.labels.added|length == 0
- gitlab_first_label_update_additions.labels.untouched|length == 0 - gitlab_first_label_update_additions.labels.untouched|length == 0
- gitlab_first_label_update_additions.labels.removed|length == 0 - gitlab_first_label_update_additions.labels.removed|length == 0
- gitlab_first_label_update_additions.labels.updated|length == 1 - gitlab_first_label_update_additions.labels.updated|length == 1
- gitlab_first_label_update_additions.labels.updated[0] == "{{ gitlab_second_label }}" - gitlab_first_label_update_additions.labels.updated[0] == "{{ gitlab_second_label }}"
- name: Delete Label {{ gitlab_second_label }} - name: Delete Label {{ gitlab_second_label }}
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
state: absent state: absent
register: gitlab_first_label_delete register: gitlab_first_label_delete
- name: Test label is deleted - name: Test label is deleted
assert: assert:
that: that:
- gitlab_first_label_delete is changed - gitlab_first_label_delete is changed
- gitlab_first_label_delete.labels.added|length == 0 - gitlab_first_label_delete.labels.added|length == 0
- gitlab_first_label_delete.labels.untouched|length == 0 - gitlab_first_label_delete.labels.untouched|length == 0
- gitlab_first_label_delete.labels.removed|length == 1 - gitlab_first_label_delete.labels.removed|length == 1
- gitlab_first_label_delete.labels.updated|length == 0 - gitlab_first_label_delete.labels.updated|length == 0
- gitlab_first_label_delete.labels.removed[0] == "{{ gitlab_second_label }}" - gitlab_first_label_delete.labels.removed[0] == "{{ gitlab_second_label }}"
- name: Create label {{ gitlab_second_label }} again purging the other - name: Create label {{ gitlab_second_label }} again purging the other
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
purge: true purge: true
labels: labels:
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
color: "{{ gitlab_second_label_color }}" color: "{{ gitlab_second_label_color }}"
state: present state: present
register: gitlab_first_label_create_purging register: gitlab_first_label_create_purging
- name: Test Label Created again - name: Test Label Created again
assert: assert:
that: that:
- gitlab_first_label_create_purging is changed - gitlab_first_label_create_purging is changed
- gitlab_first_label_create_purging.labels.added|length == 1 - gitlab_first_label_create_purging.labels.added|length == 1
- gitlab_first_label_create_purging.labels.untouched|length == 0 - gitlab_first_label_create_purging.labels.untouched|length == 0
- gitlab_first_label_create_purging.labels.removed|length == 1 - gitlab_first_label_create_purging.labels.removed|length == 1
- gitlab_first_label_create_purging.labels.updated|length == 0 - gitlab_first_label_create_purging.labels.updated|length == 0
- gitlab_first_label_create_purging.labels.added[0] == "{{ gitlab_second_label }}" - gitlab_first_label_create_purging.labels.added[0] == "{{ gitlab_second_label }}"
- gitlab_first_label_create_purging.labels.removed[0] == "{{ gitlab_first_label }}" - gitlab_first_label_create_purging.labels.removed[0] == "{{ gitlab_first_label }}"
always: always:
- name: Delete Labels - name: Delete Labels
gitlab_label: gitlab_label:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
purge: true purge: true
labels: labels:
- name: "{{ gitlab_first_label }}" - name: "{{ gitlab_first_label }}"
- name: "{{ gitlab_second_label }}" - name: "{{ gitlab_second_label }}"
state: absent state: absent
register: gitlab_first_label_always_delete register: gitlab_first_label_always_delete
- name: Test label are deleted - name: Test label are deleted
assert: assert:
that: that:
- gitlab_first_label_always_delete is changed - gitlab_first_label_always_delete is changed
- gitlab_first_label_always_delete.labels.added|length == 0 - gitlab_first_label_always_delete.labels.added|length == 0
- gitlab_first_label_always_delete.labels.untouched|length == 0 - gitlab_first_label_always_delete.labels.untouched|length == 0
- gitlab_first_label_always_delete.labels.removed|length > 0 - gitlab_first_label_always_delete.labels.removed|length > 0
- gitlab_first_label_always_delete.labels.updated|length == 0 - gitlab_first_label_always_delete.labels.updated|length == 0
- name: Clean up {{ gitlab_project_name }} - name: Clean up {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: false validate_certs: false
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
state: absent state: absent
- name: Clean up {{ gitlab_project_group }} - name: Clean up {{ gitlab_project_group }}
gitlab_group: gitlab_group:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_group }}" name: "{{ gitlab_project_group }}"
state: absent state: absent

View file

@ -14,116 +14,116 @@
state: present state: present
- block: - block:
- name: Create {{ gitlab_project_name }} - name: Create {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
default_branch: "{{ gitlab_target_branch }}" default_branch: "{{ gitlab_target_branch }}"
initialize_with_readme: true initialize_with_readme: true
state: present state: present
- name: Create branch {{ gitlab_source_branch }} - name: Create branch {{ gitlab_source_branch }}
gitlab_branch: gitlab_branch:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
branch: "{{ gitlab_source_branch }}" branch: "{{ gitlab_source_branch }}"
ref_branch: "{{ gitlab_target_branch }}" ref_branch: "{{ gitlab_target_branch }}"
state: present state: present
- name: Create Merge Request - name: Create Merge Request
gitlab_merge_request: gitlab_merge_request:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
source_branch: "{{gitlab_source_branch}}" source_branch: "{{gitlab_source_branch}}"
target_branch: "{{gitlab_target_branch}}" target_branch: "{{gitlab_target_branch}}"
title: "Ansible test merge request" title: "Ansible test merge request"
description: "Test description" description: "Test description"
labels: "" labels: ""
state_filter: "opened" state_filter: "opened"
assignee_ids: "" assignee_ids: ""
reviewer_ids: "" reviewer_ids: ""
remove_source_branch: True remove_source_branch: true
state: present state: present
register: gitlab_merge_request_create register: gitlab_merge_request_create
- name: Test Merge Request Created - name: Test Merge Request Created
assert: assert:
that: that:
- gitlab_merge_request_create is changed - gitlab_merge_request_create is changed
- name: Create Merge Request ( Idempotency test ) - name: Create Merge Request ( Idempotency test )
gitlab_merge_request: gitlab_merge_request:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
source_branch: "{{gitlab_source_branch}}" source_branch: "{{gitlab_source_branch}}"
target_branch: "{{gitlab_target_branch}}" target_branch: "{{gitlab_target_branch}}"
title: "Ansible test merge request" title: "Ansible test merge request"
description: "Test description" description: "Test description"
labels: "" labels: ""
state_filter: "opened" state_filter: "opened"
assignee_ids: "" assignee_ids: ""
reviewer_ids: "" reviewer_ids: ""
remove_source_branch: True remove_source_branch: true
state: present state: present
register: gitlab_merge_request_create_idempotence register: gitlab_merge_request_create_idempotence
- name: Test module is idempotent - name: Test module is idempotent
assert: assert:
that: that:
- gitlab_merge_request_create_idempotence is not changed - gitlab_merge_request_create_idempotence is not changed
- name: Update Merge Request Test - name: Update Merge Request Test
gitlab_merge_request: gitlab_merge_request:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
source_branch: "{{gitlab_source_branch}}" source_branch: "{{gitlab_source_branch}}"
target_branch: "{{gitlab_target_branch}}" target_branch: "{{gitlab_target_branch}}"
title: "Ansible test merge request" title: "Ansible test merge request"
description_path: "{{gitlab_description_path}}" description_path: "{{gitlab_description_path}}"
labels: "{{ gitlab_labels }}" labels: "{{ gitlab_labels }}"
state_filter: "opened" state_filter: "opened"
assignee_ids: "{{ gitlab_assignee_ids }}" assignee_ids: "{{ gitlab_assignee_ids }}"
reviewer_ids: "" reviewer_ids: ""
remove_source_branch: True remove_source_branch: true
state: present state: present
register: gitlab_merge_request_udpate register: gitlab_merge_request_udpate
- name: Test merge request updated - name: Test merge request updated
assert: assert:
that: that:
- gitlab_merge_request_udpate.mr.labels[0] == "{{ gitlab_labels }}" - gitlab_merge_request_udpate.mr.labels[0] == "{{ gitlab_labels }}"
- gitlab_merge_request_udpate.mr.assignees[0].username == "{{ gitlab_assignee_ids }}" - gitlab_merge_request_udpate.mr.assignees[0].username == "{{ gitlab_assignee_ids }}"
- "'### Description\n\nMerge Request test description' in gitlab_merge_request_udpate.mr.description" - "'### Description\n\nMerge Request test description' in gitlab_merge_request_udpate.mr.description"
- name: Delete Merge Request - name: Delete Merge Request
gitlab_merge_request: gitlab_merge_request:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
source_branch: "{{gitlab_source_branch}}" source_branch: "{{gitlab_source_branch}}"
target_branch: "{{gitlab_target_branch}}" target_branch: "{{gitlab_target_branch}}"
title: "Ansible test merge request" title: "Ansible test merge request"
state: absent state: absent
register: gitlab_merge_request_delete register: gitlab_merge_request_delete
- name: Test merge request is deleted - name: Test merge request is deleted
assert: assert:
that: that:
- gitlab_merge_request_delete is changed - gitlab_merge_request_delete is changed
always: always:
- name: Clean up {{ gitlab_project_name }} - name: Clean up {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: false validate_certs: false
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
state: absent state: absent

View file

@ -14,375 +14,375 @@
state: present state: present
- block: - block:
### ###
### Group milestone ### Group milestone
### ###
- name: Create {{ gitlab_project_group }} - name: Create {{ gitlab_project_group }}
gitlab_group: gitlab_group:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_group }}" name: "{{ gitlab_project_group }}"
state: present state: present
- name: Purge all group milestones for check_mode test - name: Purge all group milestones for check_mode test
gitlab_milestone: gitlab_milestone:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
purge: true purge: true
- name: Group milestone - Add a milestone in check_mode - name: Group milestone - Add a milestone in check_mode
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
check_mode: true check_mode: true
register: gitlab_group_milestone_state register: gitlab_group_milestone_state
- name: Group milestone - Check_mode state must be changed - name: Group milestone - Check_mode state must be changed
assert: assert:
that: that:
- gitlab_group_milestone_state is changed - gitlab_group_milestone_state is changed
- name: Purge all group milestones for project milestone test - cannot exist with same name - name: Purge all group milestones for project milestone test - cannot exist with same name
gitlab_milestone: gitlab_milestone:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
purge: true purge: true
register: gitlab_group_milestone_purged register: gitlab_group_milestone_purged
- name: Group milestone - Create milestone {{ gitlab_first_milestone }} and {{ gitlab_second_milestone }} - name: Group milestone - Create milestone {{ gitlab_first_milestone }} and {{ gitlab_second_milestone }}
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
start_date: "{{ gitlab_first_milestone_start_date }}" start_date: "{{ gitlab_first_milestone_start_date }}"
due_date: "{{ gitlab_first_milestone_due_date }}" due_date: "{{ gitlab_first_milestone_due_date }}"
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: present state: present
register: gitlab_group_milestone_create register: gitlab_group_milestone_create
- name: Group milestone - Test milestone Created - name: Group milestone - Test milestone Created
assert: assert:
that: that:
- gitlab_group_milestone_create is changed - gitlab_group_milestone_create is changed
- gitlab_group_milestone_create.milestones.added|length == 2 - gitlab_group_milestone_create.milestones.added|length == 2
- gitlab_group_milestone_create.milestones.untouched|length == 0 - gitlab_group_milestone_create.milestones.untouched|length == 0
- gitlab_group_milestone_create.milestones.removed|length == 0 - gitlab_group_milestone_create.milestones.removed|length == 0
- gitlab_group_milestone_create.milestones.updated|length == 0 - gitlab_group_milestone_create.milestones.updated|length == 0
- gitlab_group_milestone_create.milestones.added[0] == "{{ gitlab_first_milestone }}" - gitlab_group_milestone_create.milestones.added[0] == "{{ gitlab_first_milestone }}"
- gitlab_group_milestone_create.milestones.added[1] == "{{ gitlab_second_milestone }}" - gitlab_group_milestone_create.milestones.added[1] == "{{ gitlab_second_milestone }}"
- name: Group milestone - Create milestone ( Idempotency test ) - name: Group milestone - Create milestone ( Idempotency test )
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
start_date: "{{ gitlab_first_milestone_start_date }}" start_date: "{{ gitlab_first_milestone_start_date }}"
due_date: "{{ gitlab_first_milestone_due_date }}" due_date: "{{ gitlab_first_milestone_due_date }}"
state: present state: present
register: gitlab_group_milestone_create_idempotence register: gitlab_group_milestone_create_idempotence
- name: Group milestone - Test Create milestone is Idempotent - name: Group milestone - Test Create milestone is Idempotent
assert: assert:
that: that:
- gitlab_group_milestone_create_idempotence is not changed - gitlab_group_milestone_create_idempotence is not changed
- name: Group milestone - Update milestone {{ gitlab_first_milestone }} changing dates - name: Group milestone - Update milestone {{ gitlab_first_milestone }} changing dates
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
start_date: "{{ gitlab_first_milestone_new_start_date }}" start_date: "{{ gitlab_first_milestone_new_start_date }}"
due_date: "{{ gitlab_first_milestone_new_due_date }}" due_date: "{{ gitlab_first_milestone_new_due_date }}"
state: present state: present
register: gitlab_group_milestone_update register: gitlab_group_milestone_update
- name: Group milestone - Test milestone Updated - name: Group milestone - Test milestone Updated
assert: assert:
that: that:
- gitlab_group_milestone_update.milestones.added|length == 0 - gitlab_group_milestone_update.milestones.added|length == 0
- gitlab_group_milestone_update.milestones.untouched|length == 0 - gitlab_group_milestone_update.milestones.untouched|length == 0
- gitlab_group_milestone_update.milestones.removed|length == 0 - gitlab_group_milestone_update.milestones.removed|length == 0
- gitlab_group_milestone_update.milestones.updated|length == 1 - gitlab_group_milestone_update.milestones.updated|length == 1
- gitlab_group_milestone_update.milestones.updated[0] == "{{ gitlab_first_milestone }}" - gitlab_group_milestone_update.milestones.updated[0] == "{{ gitlab_first_milestone }}"
- name: Group milestone - Update milestone Test ( Additions ) - name: Group milestone - Update milestone Test ( Additions )
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
description: "{{ gitlab_first_milestone_description }}" description: "{{ gitlab_first_milestone_description }}"
state: present state: present
register: gitlab_group_milestone_update_additions register: gitlab_group_milestone_update_additions
- name: Group milestone - Test milestone Updated ( Additions ) - name: Group milestone - Test milestone Updated ( Additions )
assert: assert:
that: that:
- gitlab_group_milestone_update_additions.milestones.added|length == 0 - gitlab_group_milestone_update_additions.milestones.added|length == 0
- gitlab_group_milestone_update_additions.milestones.untouched|length == 0 - gitlab_group_milestone_update_additions.milestones.untouched|length == 0
- gitlab_group_milestone_update_additions.milestones.removed|length == 0 - gitlab_group_milestone_update_additions.milestones.removed|length == 0
- gitlab_group_milestone_update_additions.milestones.updated|length == 1 - gitlab_group_milestone_update_additions.milestones.updated|length == 1
- gitlab_group_milestone_update_additions.milestones.updated[0] == "{{ gitlab_second_milestone }}" - gitlab_group_milestone_update_additions.milestones.updated[0] == "{{ gitlab_second_milestone }}"
- name: Group milestone - Delete milestone {{ gitlab_second_milestone }} - name: Group milestone - Delete milestone {{ gitlab_second_milestone }}
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: absent state: absent
register: gitlab_group_milestone_delete register: gitlab_group_milestone_delete
- name: Group milestone - Test milestone is deleted - name: Group milestone - Test milestone is deleted
assert: assert:
that: that:
- gitlab_group_milestone_delete is changed - gitlab_group_milestone_delete is changed
- gitlab_group_milestone_delete.milestones.added|length == 0 - gitlab_group_milestone_delete.milestones.added|length == 0
- gitlab_group_milestone_delete.milestones.untouched|length == 0 - gitlab_group_milestone_delete.milestones.untouched|length == 0
- gitlab_group_milestone_delete.milestones.removed|length == 1 - gitlab_group_milestone_delete.milestones.removed|length == 1
- gitlab_group_milestone_delete.milestones.updated|length == 0 - gitlab_group_milestone_delete.milestones.updated|length == 0
- gitlab_group_milestone_delete.milestones.removed[0] == "{{ gitlab_second_milestone }}" - gitlab_group_milestone_delete.milestones.removed[0] == "{{ gitlab_second_milestone }}"
- name: Group milestone - Create group milestone {{ gitlab_second_milestone }} again purging the other - name: Group milestone - Create group milestone {{ gitlab_second_milestone }} again purging the other
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
purge: true purge: true
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: present state: present
register: gitlab_group_milestone_create_purging register: gitlab_group_milestone_create_purging
- name: Group milestone - Test milestone Created again - name: Group milestone - Test milestone Created again
assert: assert:
that: that:
- gitlab_group_milestone_create_purging is changed - gitlab_group_milestone_create_purging is changed
- gitlab_group_milestone_create_purging.milestones.added|length == 1 - gitlab_group_milestone_create_purging.milestones.added|length == 1
- gitlab_group_milestone_create_purging.milestones.untouched|length == 0 - gitlab_group_milestone_create_purging.milestones.untouched|length == 0
- gitlab_group_milestone_create_purging.milestones.removed|length == 1 - gitlab_group_milestone_create_purging.milestones.removed|length == 1
- gitlab_group_milestone_create_purging.milestones.updated|length == 0 - gitlab_group_milestone_create_purging.milestones.updated|length == 0
- gitlab_group_milestone_create_purging.milestones.added[0] == "{{ gitlab_second_milestone }}" - gitlab_group_milestone_create_purging.milestones.added[0] == "{{ gitlab_second_milestone }}"
- gitlab_group_milestone_create_purging.milestones.removed[0] == "{{ gitlab_first_milestone }}" - gitlab_group_milestone_create_purging.milestones.removed[0] == "{{ gitlab_first_milestone }}"
### ###
### Project milestone ### Project milestone
### ###
- name: Purge all group milestones for project milestone test - cannot exist with same name - name: Purge all group milestones for project milestone test - cannot exist with same name
gitlab_milestone: gitlab_milestone:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
purge: true purge: true
register: gitlab_group_milestone_purged register: gitlab_group_milestone_purged
- name: Create {{ gitlab_project_name }} - name: Create {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
default_branch: "{{ gitlab_branch }}" default_branch: "{{ gitlab_branch }}"
initialize_with_readme: true initialize_with_readme: true
state: present state: present
- name: Purge all milestones for check_mode test - name: Purge all milestones for check_mode test
gitlab_milestone: gitlab_milestone:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
purge: true purge: true
- name: Add a milestone in check_mode - name: Add a milestone in check_mode
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
description: "{{ gitlab_second_milestone_description }}" description: "{{ gitlab_second_milestone_description }}"
check_mode: true check_mode: true
register: gitlab_first_milestone_state register: gitlab_first_milestone_state
- name: Check_mode state must be changed - name: Check_mode state must be changed
assert: assert:
that: that:
- gitlab_first_milestone_state is changed - gitlab_first_milestone_state is changed
- name: Create milestone {{ gitlab_first_milestone }} and {{ gitlab_second_milestone }} - name: Create milestone {{ gitlab_first_milestone }} and {{ gitlab_second_milestone }}
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
start_date: "{{ gitlab_first_milestone_start_date }}" start_date: "{{ gitlab_first_milestone_start_date }}"
due_date: "{{ gitlab_first_milestone_due_date }}" due_date: "{{ gitlab_first_milestone_due_date }}"
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: present state: present
register: gitlab_milestones_create register: gitlab_milestones_create
- name: Test milestone Created - name: Test milestone Created
assert: assert:
that: that:
- gitlab_milestones_create is changed - gitlab_milestones_create is changed
- gitlab_milestones_create.milestones.added|length == 2 - gitlab_milestones_create.milestones.added|length == 2
- gitlab_milestones_create.milestones.untouched|length == 0 - gitlab_milestones_create.milestones.untouched|length == 0
- gitlab_milestones_create.milestones.removed|length == 0 - gitlab_milestones_create.milestones.removed|length == 0
- gitlab_milestones_create.milestones.updated|length == 0 - gitlab_milestones_create.milestones.updated|length == 0
- gitlab_milestones_create.milestones.added[0] == "{{ gitlab_first_milestone }}" - gitlab_milestones_create.milestones.added[0] == "{{ gitlab_first_milestone }}"
- gitlab_milestones_create.milestones.added[1] == "{{ gitlab_second_milestone }}" - gitlab_milestones_create.milestones.added[1] == "{{ gitlab_second_milestone }}"
- name: Create milestone ( Idempotency test ) - name: Create milestone ( Idempotency test )
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
start_date: "{{ gitlab_first_milestone_start_date }}" start_date: "{{ gitlab_first_milestone_start_date }}"
due_date: "{{ gitlab_first_milestone_due_date }}" due_date: "{{ gitlab_first_milestone_due_date }}"
state: present state: present
register: gitlab_first_milestone_create_idempotence register: gitlab_first_milestone_create_idempotence
- name: Test Create milestone is Idempotent - name: Test Create milestone is Idempotent
assert: assert:
that: that:
- gitlab_first_milestone_create_idempotence is not changed - gitlab_first_milestone_create_idempotence is not changed
- name: Update milestone {{ gitlab_first_milestone }} changing dates - name: Update milestone {{ gitlab_first_milestone }} changing dates
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
start_date: "{{ gitlab_first_milestone_new_start_date }}" start_date: "{{ gitlab_first_milestone_new_start_date }}"
due_date: "{{ gitlab_first_milestone_new_due_date }}" due_date: "{{ gitlab_first_milestone_new_due_date }}"
state: present state: present
register: gitlab_first_milestone_update register: gitlab_first_milestone_update
- name: Test milestone Updated - name: Test milestone Updated
assert: assert:
that: that:
- gitlab_first_milestone_update.milestones.added|length == 0 - gitlab_first_milestone_update.milestones.added|length == 0
- gitlab_first_milestone_update.milestones.untouched|length == 0 - gitlab_first_milestone_update.milestones.untouched|length == 0
- gitlab_first_milestone_update.milestones.removed|length == 0 - gitlab_first_milestone_update.milestones.removed|length == 0
- gitlab_first_milestone_update.milestones.updated|length == 1 - gitlab_first_milestone_update.milestones.updated|length == 1
- gitlab_first_milestone_update.milestones.updated[0] == "{{ gitlab_first_milestone }}" - gitlab_first_milestone_update.milestones.updated[0] == "{{ gitlab_first_milestone }}"
- name: Update milestone Test ( Additions ) - name: Update milestone Test ( Additions )
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
description: "{{ gitlab_second_milestone_description }}" description: "{{ gitlab_second_milestone_description }}"
state: present state: present
register: gitlab_first_milestone_update_additions register: gitlab_first_milestone_update_additions
- name: Test milestone Updated ( Additions ) - name: Test milestone Updated ( Additions )
assert: assert:
that: that:
- gitlab_first_milestone_update_additions.milestones.added|length == 0 - gitlab_first_milestone_update_additions.milestones.added|length == 0
- gitlab_first_milestone_update_additions.milestones.untouched|length == 0 - gitlab_first_milestone_update_additions.milestones.untouched|length == 0
- gitlab_first_milestone_update_additions.milestones.removed|length == 0 - gitlab_first_milestone_update_additions.milestones.removed|length == 0
- gitlab_first_milestone_update_additions.milestones.updated|length == 1 - gitlab_first_milestone_update_additions.milestones.updated|length == 1
- gitlab_first_milestone_update_additions.milestones.updated[0] == "{{ gitlab_second_milestone }}" - gitlab_first_milestone_update_additions.milestones.updated[0] == "{{ gitlab_second_milestone }}"
- name: Delete milestone {{ gitlab_second_milestone }} - name: Delete milestone {{ gitlab_second_milestone }}
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: absent state: absent
register: gitlab_first_milestone_delete register: gitlab_first_milestone_delete
- name: Test milestone is deleted - name: Test milestone is deleted
assert: assert:
that: that:
- gitlab_first_milestone_delete is changed - gitlab_first_milestone_delete is changed
- gitlab_first_milestone_delete.milestones.added|length == 0 - gitlab_first_milestone_delete.milestones.added|length == 0
- gitlab_first_milestone_delete.milestones.untouched|length == 0 - gitlab_first_milestone_delete.milestones.untouched|length == 0
- gitlab_first_milestone_delete.milestones.removed|length == 1 - gitlab_first_milestone_delete.milestones.removed|length == 1
- gitlab_first_milestone_delete.milestones.updated|length == 0 - gitlab_first_milestone_delete.milestones.updated|length == 0
- gitlab_first_milestone_delete.milestones.removed[0] == "{{ gitlab_second_milestone }}" - gitlab_first_milestone_delete.milestones.removed[0] == "{{ gitlab_second_milestone }}"
- name: Create milestone {{ gitlab_second_milestone }} again purging the other - name: Create milestone {{ gitlab_second_milestone }} again purging the other
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
purge: true purge: true
milestones: milestones:
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: present state: present
register: gitlab_first_milestone_create_purging register: gitlab_first_milestone_create_purging
- name: Test milestone Created again - name: Test milestone Created again
assert: assert:
that: that:
- gitlab_first_milestone_create_purging is changed - gitlab_first_milestone_create_purging is changed
- gitlab_first_milestone_create_purging.milestones.added|length == 1 - gitlab_first_milestone_create_purging.milestones.added|length == 1
- gitlab_first_milestone_create_purging.milestones.untouched|length == 0 - gitlab_first_milestone_create_purging.milestones.untouched|length == 0
- gitlab_first_milestone_create_purging.milestones.removed|length == 1 - gitlab_first_milestone_create_purging.milestones.removed|length == 1
- gitlab_first_milestone_create_purging.milestones.updated|length == 0 - gitlab_first_milestone_create_purging.milestones.updated|length == 0
- gitlab_first_milestone_create_purging.milestones.added[0] == "{{ gitlab_second_milestone }}" - gitlab_first_milestone_create_purging.milestones.added[0] == "{{ gitlab_second_milestone }}"
- gitlab_first_milestone_create_purging.milestones.removed[0] == "{{ gitlab_first_milestone }}" - gitlab_first_milestone_create_purging.milestones.removed[0] == "{{ gitlab_first_milestone }}"
always: always:
- name: Delete milestones - name: Delete milestones
gitlab_milestone: gitlab_milestone:
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}" project: "{{ gitlab_project_group }}/{{ gitlab_project_name }}"
purge: true purge: true
milestones: milestones:
- title: "{{ gitlab_first_milestone }}" - title: "{{ gitlab_first_milestone }}"
- title: "{{ gitlab_second_milestone }}" - title: "{{ gitlab_second_milestone }}"
state: absent state: absent
register: gitlab_first_milestone_always_delete register: gitlab_first_milestone_always_delete
- name: Test milestone are deleted - name: Test milestone are deleted
assert: assert:
that: that:
- gitlab_first_milestone_always_delete is changed - gitlab_first_milestone_always_delete is changed
- gitlab_first_milestone_always_delete.milestones.added|length == 0 - gitlab_first_milestone_always_delete.milestones.added|length == 0
- gitlab_first_milestone_always_delete.milestones.untouched|length == 0 - gitlab_first_milestone_always_delete.milestones.untouched|length == 0
- gitlab_first_milestone_always_delete.milestones.removed|length > 0 - gitlab_first_milestone_always_delete.milestones.removed|length > 0
- gitlab_first_milestone_always_delete.milestones.updated|length == 0 - gitlab_first_milestone_always_delete.milestones.updated|length == 0
- name: Clean up {{ gitlab_project_name }} - name: Clean up {{ gitlab_project_name }}
gitlab_project: gitlab_project:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: false validate_certs: false
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}" name: "{{ gitlab_project_name }}"
group: "{{ gitlab_project_group }}" group: "{{ gitlab_project_group }}"
state: absent state: absent
- name: Clean up {{ gitlab_project_group }} - name: Clean up {{ gitlab_project_group }}
gitlab_group: gitlab_group:
api_url: "{{ gitlab_host }}" api_url: "{{ gitlab_host }}"
validate_certs: true validate_certs: true
api_token: "{{ gitlab_api_token }}" api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_group }}" name: "{{ gitlab_project_group }}"
state: absent state: absent

View file

@ -25,8 +25,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: create_pfail_token_status register: create_pfail_token_status
always: always:
- name: Assert that token creation in nonexisting project failed - name: Assert that token creation in nonexisting project failed
@ -47,8 +47,8 @@
expires_at: '2025-13-01' expires_at: '2025-13-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: create_efail_token_status register: create_efail_token_status
always: always:
- name: Assert that token creation with invalid expires_at failed - name: Assert that token creation with invalid expires_at failed
@ -68,8 +68,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: create_token_status register: create_token_status
- name: Assert that token creation with valid arguments is successfull - name: Assert that token creation with valid arguments is successfull
assert: assert:
@ -88,8 +88,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: check_token_status register: check_token_status
- name: Assert that token creation without changes and recreate=never succeeds with status not changed - name: Assert that token creation without changes and recreate=never succeeds with status not changed
assert: assert:
@ -108,8 +108,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
recreate: state_change recreate: state_change
register: check_recreate_token_status register: check_recreate_token_status
- name: Assert that token creation without changes and recreate=state_change succeeds with status not changed - name: Assert that token creation without changes and recreate=state_change succeeds with status not changed
@ -130,8 +130,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: change_token_status register: change_token_status
always: always:
- name: Assert that token change with recreate=never fails - name: Assert that token change with recreate=never fails
@ -151,8 +151,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
recreate: state_change recreate: state_change
register: change_recreate_token_status register: change_recreate_token_status
- name: Assert that token change with recreate=state_change succeeds - name: Assert that token change with recreate=state_change succeeds
@ -172,8 +172,8 @@
expires_at: '2025-01-01' expires_at: '2025-01-01'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
recreate: always recreate: always
register: change_recreate1_token_status register: change_recreate1_token_status
- name: Assert that token change with recreate=always succeeds - name: Assert that token change with recreate=always succeeds
@ -193,8 +193,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: revoke_token_status register: revoke_token_status
- name: Assert that token revocation succeeds - name: Assert that token revocation succeeds
assert: assert:
@ -212,8 +212,8 @@
expires_at: '2024-12-31' expires_at: '2024-12-31'
access_level: developer access_level: developer
scopes: scopes:
- api - api
- read_api - read_api
register: revoke_token_status register: revoke_token_status
- name: Assert that token revocation succeeds with status not changed - name: Assert that token revocation succeeds with status not changed
assert: assert:

View file

@ -479,7 +479,7 @@
- gitlab_project_variable_state.project_variable.removed|length == 0 - gitlab_project_variable_state.project_variable.removed|length == 0
- gitlab_project_variable_state.project_variable.updated|length == 0 - gitlab_project_variable_state.project_variable.updated|length == 0
# VALUE_SPECIFIED_IN_NO_LOG_PARAMETER # VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#- gitlab_project_variable_state.project_variable.added[0] == "my_test_var" # - gitlab_project_variable_state.project_variable.added[0] == "my_test_var"
- name: change variable_type attribute - name: change variable_type attribute
gitlab_project_variable: gitlab_project_variable:

View file

@ -22,16 +22,16 @@
when: (ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04") or ansible_python_version is version("2.7.9", "<") when: (ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04") or ansible_python_version is version("2.7.9", "<")
- block: - block:
- name: install mercurial - name: install mercurial
include_tasks: install.yml include_tasks: install.yml
when: has_hg is failed when: has_hg is failed
- name: test mercurial - name: test mercurial
include_tasks: run-tests.yml include_tasks: run-tests.yml
- name: uninstall mercurial - name: uninstall mercurial
include_tasks: uninstall.yml include_tasks: uninstall.yml
when: has_hg is failed when: has_hg is failed
# As per the bitbucket changes in https://bitbucket.org/blog/deprecating-tlsv1-tlsv1-1-2018-12-01 , this # As per the bitbucket changes in https://bitbucket.org/blog/deprecating-tlsv1-tlsv1-1-2018-12-01 , this
# test will fail under certain circumstances, to avoid false positives, we skip these tests under the following # test will fail under certain circumstances, to avoid false positives, we skip these tests under the following
@ -41,5 +41,5 @@
# - When ansible_python_version is not 2.7.9 or higher, mercurial is likely to also run using this same (old) # - When ansible_python_version is not 2.7.9 or higher, mercurial is likely to also run using this same (old)
# python version, which causes issues as per the link above. # python version, which causes issues as per the link above.
when: when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04") - not (ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04")
- ansible_python_version is version("2.7.9", ">=") - ansible_python_version is version("2.7.9", ">=")

View file

@ -18,89 +18,89 @@
path: "{{ brew_which.stdout }}" path: "{{ brew_which.stdout }}"
register: brew_stat register: brew_stat
#- name: Use ignored-pinned option while upgrading all # - name: Use ignored-pinned option while upgrading all
# homebrew: # homebrew:
# upgrade_all: true # upgrade_all: true
# upgrade_options: ignore-pinned # upgrade_options: ignore-pinned
# become: true # become: true
# become_user: "{{ brew_stat.stat.pw_name }}" # become_user: "{{ brew_stat.stat.pw_name }}"
# register: upgrade_option_result # register: upgrade_option_result
# environment: # environment:
# HOMEBREW_NO_AUTO_UPDATE: True # HOMEBREW_NO_AUTO_UPDATE: True
#- assert: # - assert:
# that: # that:
# - upgrade_option_result.changed # - upgrade_option_result.changed
- vars: - vars:
package_name: kitty package_name: kitty
block: block:
- name: Make sure {{ package_name }} package is not installed - name: Make sure {{ package_name }} package is not installed
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: absent state: absent
update_homebrew: false update_homebrew: false
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install {{ package_name }} package using homebrew - name: Install {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: present state: present
update_homebrew: false update_homebrew: false
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- name: Again install {{ package_name }} package using homebrew - name: Again install {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: present state: present
update_homebrew: false update_homebrew: false
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- name: Uninstall {{ package_name }} package using homebrew - name: Uninstall {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: absent state: absent
update_homebrew: false update_homebrew: false
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- name: Again uninstall {{ package_name }} package using homebrew - name: Again uninstall {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: absent state: absent
update_homebrew: false update_homebrew: false
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
# This crashed on 4867eb4 - Ref: issue #9777 # This crashed on 4867eb4 - Ref: issue #9777
- name: Install cask using homelab/cask syntax - name: Install cask using homelab/cask syntax
homebrew: homebrew:
package: "homebrew/cask/{{ package_name }}" package: "homebrew/cask/{{ package_name }}"
state: present state: present
update_homebrew: false update_homebrew: false
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"

View file

@ -18,150 +18,150 @@
path: "{{ brew_which.stdout }}" path: "{{ brew_which.stdout }}"
register: brew_stat register: brew_stat
#- name: Use ignored-pinned option while upgrading all # - name: Use ignored-pinned option while upgrading all
# homebrew: # homebrew:
# upgrade_all: true # upgrade_all: true
# upgrade_options: ignore-pinned # upgrade_options: ignore-pinned
# become: true # become: true
# become_user: "{{ brew_stat.stat.pw_name }}" # become_user: "{{ brew_stat.stat.pw_name }}"
# register: upgrade_option_result # register: upgrade_option_result
# environment: # environment:
# HOMEBREW_NO_AUTO_UPDATE: True # HOMEBREW_NO_AUTO_UPDATE: True
#- assert: # - assert:
# that: # that:
# - upgrade_option_result.changed # - upgrade_option_result.changed
- vars: - vars:
package_name: gnu-tar package_name: gnu-tar
block: block:
- name: Make sure {{ package_name }} package is not installed - name: Make sure {{ package_name }} package is not installed
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install {{ package_name }} package using homebrew - name: Install {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Package installed: gnu-tar'" - "package_result.msg == 'Package installed: gnu-tar'"
- "package_result.changed_pkgs == ['gnu-tar']" - "package_result.changed_pkgs == ['gnu-tar']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Again install {{ package_name }} package using homebrew - name: Again install {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- "package_result.msg == 'Package already installed: gnu-tar'" - "package_result.msg == 'Package already installed: gnu-tar'"
- "package_result.changed_pkgs == []" - "package_result.changed_pkgs == []"
- "package_result.unchanged_pkgs == ['gnu-tar']" - "package_result.unchanged_pkgs == ['gnu-tar']"
- name: Unlink {{ package_name }} package using homebrew - name: Unlink {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: unlinked state: unlinked
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Package unlinked: gnu-tar'" - "package_result.msg == 'Package unlinked: gnu-tar'"
- "package_result.changed_pkgs == ['gnu-tar']" - "package_result.changed_pkgs == ['gnu-tar']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Link {{ package_name }} package using homebrew - name: Link {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: linked state: linked
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Package linked: gnu-tar'" - "package_result.msg == 'Package linked: gnu-tar'"
- "package_result.changed_pkgs == ['gnu-tar']" - "package_result.changed_pkgs == ['gnu-tar']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Uninstall {{ package_name }} package using homebrew - name: Uninstall {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Package uninstalled: gnu-tar'" - "package_result.msg == 'Package uninstalled: gnu-tar'"
- "package_result.changed_pkgs == ['gnu-tar']" - "package_result.changed_pkgs == ['gnu-tar']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Again uninstall {{ package_name }} package using homebrew - name: Again uninstall {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- "package_result.msg == 'Package already uninstalled: gnu-tar'" - "package_result.msg == 'Package already uninstalled: gnu-tar'"
- "package_result.changed_pkgs == []" - "package_result.changed_pkgs == []"
- "package_result.unchanged_pkgs == ['gnu-tar']" - "package_result.unchanged_pkgs == ['gnu-tar']"
- name: Upgrade {{ package_name }} package using homebrew - name: Upgrade {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: latest state: latest
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Package upgraded: gnu-tar'" - "package_result.msg == 'Package upgraded: gnu-tar'"
- "package_result.changed_pkgs == ['gnu-tar']" - "package_result.changed_pkgs == ['gnu-tar']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Again upgrade {{ package_name }} package using homebrew - name: Again upgrade {{ package_name }} package using homebrew
homebrew: homebrew:
name: "{{ package_name }}" name: "{{ package_name }}"
state: latest state: latest
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- "package_result.msg == 'Package already upgraded: gnu-tar'" - "package_result.msg == 'Package already upgraded: gnu-tar'"
- "package_result.changed_pkgs == []" - "package_result.changed_pkgs == []"
- "package_result.unchanged_pkgs == ['gnu-tar']" - "package_result.unchanged_pkgs == ['gnu-tar']"
- vars: - vars:
package_names: package_names:
@ -169,313 +169,313 @@
- gnu-time - gnu-time
block: block:
- name: Make sure {{ package_names }} packages are not installed - name: Make sure {{ package_names }} packages are not installed
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install only {{ package_names[0] }} package using homebrew - name: Install only {{ package_names[0] }} package using homebrew
homebrew: homebrew:
name: "{{ package_names[0] }}" name: "{{ package_names[0] }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install {{ package_names }} packages using homebrew (one is already installed) - name: Install {{ package_names }} packages using homebrew (one is already installed)
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Changed: 1, Unchanged: 1'" - "package_result.msg == 'Changed: 1, Unchanged: 1'"
- "package_result.changed_pkgs == ['gnu-time']" - "package_result.changed_pkgs == ['gnu-time']"
- "package_result.unchanged_pkgs == ['gnu-tar']" - "package_result.unchanged_pkgs == ['gnu-tar']"
- name: Again install {{ package_names }} packages using homebrew - name: Again install {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- "package_result.msg == 'Changed: 0, Unchanged: 2'" - "package_result.msg == 'Changed: 0, Unchanged: 2'"
- "package_result.changed_pkgs == []" - "package_result.changed_pkgs == []"
- "package_result.unchanged_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.unchanged_pkgs | sort == ['gnu-tar', 'gnu-time']"
- name: Unlink {{ package_names }} packages using homebrew - name: Unlink {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: unlinked state: unlinked
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Changed: 2, Unchanged: 0'" - "package_result.msg == 'Changed: 2, Unchanged: 0'"
- "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Link {{ package_names }} packages using homebrew - name: Link {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: linked state: linked
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Changed: 2, Unchanged: 0'" - "package_result.msg == 'Changed: 2, Unchanged: 0'"
- "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Uninstall {{ package_names }} packages using homebrew - name: Uninstall {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Changed: 2, Unchanged: 0'" - "package_result.msg == 'Changed: 2, Unchanged: 0'"
- "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Again uninstall {{ package_names }} packages using homebrew - name: Again uninstall {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- "package_result.msg == 'Changed: 0, Unchanged: 2'" - "package_result.msg == 'Changed: 0, Unchanged: 2'"
- "package_result.changed_pkgs == []" - "package_result.changed_pkgs == []"
- "package_result.unchanged_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.unchanged_pkgs | sort == ['gnu-tar', 'gnu-time']"
- name: Upgrade {{ package_names }} packages using homebrew - name: Upgrade {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: latest state: latest
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is changed - package_result is changed
- "package_result.msg == 'Changed: 2, Unchanged: 0'" - "package_result.msg == 'Changed: 2, Unchanged: 0'"
- "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.changed_pkgs | sort == ['gnu-tar', 'gnu-time']"
- "package_result.unchanged_pkgs == []" - "package_result.unchanged_pkgs == []"
- name: Again upgrade {{ package_names }} packages using homebrew - name: Again upgrade {{ package_names }} packages using homebrew
homebrew: homebrew:
name: "{{ package_names }}" name: "{{ package_names }}"
state: latest state: latest
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: package_result register: package_result
- assert: - assert:
that: that:
- package_result is not changed - package_result is not changed
- "package_result.msg == 'Changed: 0, Unchanged: 2'" - "package_result.msg == 'Changed: 0, Unchanged: 2'"
- "package_result.changed_pkgs == []" - "package_result.changed_pkgs == []"
- "package_result.unchanged_pkgs | sort == ['gnu-tar', 'gnu-time']" - "package_result.unchanged_pkgs | sort == ['gnu-tar', 'gnu-time']"
# Test alias handling with sqlite (that is aliased to sqlite3) # Test alias handling with sqlite (that is aliased to sqlite3)
- block: - block:
- name: Make sure sqlite package is not installed - name: Make sure sqlite package is not installed
homebrew: homebrew:
name: "sqlite" name: "sqlite"
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install sqlite package using alias (sqlite3) - name: Install sqlite package using alias (sqlite3)
homebrew: homebrew:
name: "sqlite3" name: "sqlite3"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: install_result register: install_result
- assert: - assert:
that: that:
- install_result is changed - install_result is changed
- "install_result.msg == 'Package installed: sqlite3'" - "install_result.msg == 'Package installed: sqlite3'"
- "install_result.changed_pkgs == ['sqlite3']" - "install_result.changed_pkgs == ['sqlite3']"
- "install_result.unchanged_pkgs == []" - "install_result.unchanged_pkgs == []"
- name: Again install sqlite package using alias (sqlite3) - name: Again install sqlite package using alias (sqlite3)
homebrew: homebrew:
name: "sqlite3" name: "sqlite3"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: reinstall_result register: reinstall_result
- assert: - assert:
that: that:
- reinstall_result is not changed - reinstall_result is not changed
- "reinstall_result.msg == 'Package already installed: sqlite3'" - "reinstall_result.msg == 'Package already installed: sqlite3'"
- "reinstall_result.changed_pkgs == []" - "reinstall_result.changed_pkgs == []"
- "reinstall_result.unchanged_pkgs == ['sqlite3']" - "reinstall_result.unchanged_pkgs == ['sqlite3']"
# Test install from homebrew tap # Test install from homebrew tap
- block: - block:
- name: Tap hashicorp repository - name: Tap hashicorp repository
community.general.homebrew_tap: community.general.homebrew_tap:
name: hashicorp/tap name: hashicorp/tap
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install terraform from tap - name: Install terraform from tap
community.general.homebrew: community.general.homebrew:
name: hashicorp/tap/terraform name: hashicorp/tap/terraform
state: latest state: latest
register: terraform_install_result register: terraform_install_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- terraform_install_result is changed - terraform_install_result is changed
- "terraform_install_result.msg == 'Package upgraded: hashicorp/tap/terraform'" - "terraform_install_result.msg == 'Package upgraded: hashicorp/tap/terraform'"
- "terraform_install_result.changed_pkgs == ['hashicorp/tap/terraform']" - "terraform_install_result.changed_pkgs == ['hashicorp/tap/terraform']"
- "terraform_install_result.unchanged_pkgs == []" - "terraform_install_result.unchanged_pkgs == []"
- name: Remove terraform - name: Remove terraform
homebrew: homebrew:
name: hashicorp/tap/terraform name: hashicorp/tap/terraform
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
# Test irregular formulae name case # Test irregular formulae name case
- block: - block:
- name: Install terraform from full tap name with irregular case - name: Install terraform from full tap name with irregular case
community.general.homebrew: community.general.homebrew:
name: HasHicorp/TAp/tErRaForm name: HasHicorp/TAp/tErRaForm
state: latest state: latest
register: terraform_install_result register: terraform_install_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- terraform_install_result is changed - terraform_install_result is changed
- "terraform_install_result.msg == 'Package upgraded: hashicorp/tap/terraform'" - "terraform_install_result.msg == 'Package upgraded: hashicorp/tap/terraform'"
- "terraform_install_result.changed_pkgs == ['hashicorp/tap/terraform']" - "terraform_install_result.changed_pkgs == ['hashicorp/tap/terraform']"
- "terraform_install_result.unchanged_pkgs == []" - "terraform_install_result.unchanged_pkgs == []"
# Test tap with no public fallback # Test tap with no public fallback
- block: - block:
- name: Tap ascii-image-converter homebrew repository - name: Tap ascii-image-converter homebrew repository
community.general.homebrew_tap: community.general.homebrew_tap:
name: TheZoraiz/ascii-image-converter name: TheZoraiz/ascii-image-converter
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- name: Install ascii from full tap name - name: Install ascii from full tap name
community.general.homebrew: community.general.homebrew:
name: TheZoraiz/ascii-image-converter/ascii-image-converter name: TheZoraiz/ascii-image-converter/ascii-image-converter
state: latest state: latest
register: ascii_install_result register: ascii_install_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- ascii_install_result is changed - ascii_install_result is changed
- "ascii_install_result.msg == 'Package upgraded: thezoraiz/ascii-image-converter/ascii-image-converter'" - "ascii_install_result.msg == 'Package upgraded: thezoraiz/ascii-image-converter/ascii-image-converter'"
- "ascii_install_result.changed_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']" - "ascii_install_result.changed_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']"
- "ascii_install_result.unchanged_pkgs == []" - "ascii_install_result.unchanged_pkgs == []"
- name: Again install ascii from full tap name - name: Again install ascii from full tap name
community.general.homebrew: community.general.homebrew:
name: TheZoraiz/ascii-image-converter/ascii-image-converter name: TheZoraiz/ascii-image-converter/ascii-image-converter
state: latest state: latest
register: ascii_reinstall_result register: ascii_reinstall_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- ascii_reinstall_result is not changed - ascii_reinstall_result is not changed
- "ascii_reinstall_result.msg == 'Package already upgraded: thezoraiz/ascii-image-converter/ascii-image-converter'" - "ascii_reinstall_result.msg == 'Package already upgraded: thezoraiz/ascii-image-converter/ascii-image-converter'"
- "ascii_reinstall_result.changed_pkgs == []" - "ascii_reinstall_result.changed_pkgs == []"
- "ascii_reinstall_result.unchanged_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']" - "ascii_reinstall_result.unchanged_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']"
- name: Remove ascii from full tap name - name: Remove ascii from full tap name
homebrew: homebrew:
name: TheZoraiz/ascii-image-converter/ascii-image-converter name: TheZoraiz/ascii-image-converter/ascii-image-converter
state: absent state: absent
register: ascii_uninstall_result register: ascii_uninstall_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- ascii_uninstall_result is changed - ascii_uninstall_result is changed
- "ascii_uninstall_result.msg == 'Package uninstalled: thezoraiz/ascii-image-converter/ascii-image-converter'" - "ascii_uninstall_result.msg == 'Package uninstalled: thezoraiz/ascii-image-converter/ascii-image-converter'"
- "ascii_uninstall_result.changed_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']" - "ascii_uninstall_result.changed_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']"
- "ascii_uninstall_result.unchanged_pkgs == []" - "ascii_uninstall_result.unchanged_pkgs == []"
- name: Again remove ascii from full tap name - name: Again remove ascii from full tap name
homebrew: homebrew:
name: TheZoraiz/ascii-image-converter/ascii-image-converter name: TheZoraiz/ascii-image-converter/ascii-image-converter
state: absent state: absent
register: ascii_again_uninstall_result register: ascii_again_uninstall_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- ascii_again_uninstall_result is not changed - ascii_again_uninstall_result is not changed
- "ascii_again_uninstall_result.msg == 'Package already uninstalled: thezoraiz/ascii-image-converter/ascii-image-converter'" - "ascii_again_uninstall_result.msg == 'Package already uninstalled: thezoraiz/ascii-image-converter/ascii-image-converter'"
- "ascii_again_uninstall_result.changed_pkgs == []" - "ascii_again_uninstall_result.changed_pkgs == []"
- "ascii_again_uninstall_result.unchanged_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']" - "ascii_again_uninstall_result.unchanged_pkgs == ['thezoraiz/ascii-image-converter/ascii-image-converter']"
- name: Install ascii from regular name - name: Install ascii from regular name
community.general.homebrew: community.general.homebrew:
name: ascii-image-converter name: ascii-image-converter
state: latest state: latest
register: ascii_install_result register: ascii_install_result
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
- assert: - assert:
that: that:
- ascii_install_result is changed - ascii_install_result is changed
- "ascii_install_result.msg == 'Package upgraded: ascii-image-converter'" - "ascii_install_result.msg == 'Package upgraded: ascii-image-converter'"
- "ascii_install_result.changed_pkgs == ['ascii-image-converter']" - "ascii_install_result.changed_pkgs == ['ascii-image-converter']"
- "ascii_install_result.unchanged_pkgs == []" - "ascii_install_result.unchanged_pkgs == []"
- name: Remove ascii from regular name - name: Remove ascii from regular name
homebrew: homebrew:
name: ascii-image-converter name: ascii-image-converter
state: absent state: absent
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"

View file

@ -9,65 +9,65 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
- name: Find brew binary - name: Find brew binary
command: which brew command: which brew
register: brew_which register: brew_which
when: ansible_distribution in ['MacOSX'] when: ansible_distribution in ['MacOSX']
- name: Get owner of brew binary - name: Get owner of brew binary
stat: stat:
path: "{{ brew_which.stdout }}" path: "{{ brew_which.stdout }}"
register: brew_stat register: brew_stat
when: ansible_distribution in ['MacOSX'] when: ansible_distribution in ['MacOSX']
- block: - block:
- name: Install cask - name: Install cask
homebrew_cask: homebrew_cask:
name: "{{ cask }}" name: "{{ cask }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: cask_install_result register: cask_install_result
- assert: - assert:
that: that:
- cask_install_result is changed - cask_install_result is changed
- "'Cask installed' in cask_install_result.msg" - "'Cask installed' in cask_install_result.msg"
- name: Install cask (idempotence) - name: Install cask (idempotence)
homebrew_cask: homebrew_cask:
name: "{{ cask }}" name: "{{ cask }}"
state: present state: present
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: cask_install_result register: cask_install_result
- assert: - assert:
that: that:
- cask_install_result is not changed - cask_install_result is not changed
- "'Cask installed' not in cask_install_result.msg" - "'Cask installed' not in cask_install_result.msg"
- "'Cask already installed' in cask_install_result.msg" - "'Cask already installed' in cask_install_result.msg"
- name: Install cask with force install option - name: Install cask with force install option
homebrew_cask: homebrew_cask:
name: "{{ cask }}" name: "{{ cask }}"
state: present state: present
install_options: force install_options: force
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
register: cask_install_result register: cask_install_result
- assert: - assert:
that: that:
- cask_install_result is changed - cask_install_result is changed
- "'Cask installed' in cask_install_result.msg" - "'Cask installed' in cask_install_result.msg"
always: always:
- name: Delete cask - name: Delete cask
homebrew_cask: homebrew_cask:
name: "{{ cask }}" name: "{{ cask }}"
state: absent state: absent
install_options: force install_options: force
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
ignore_errors: true ignore_errors: true

View file

@ -20,67 +20,67 @@
become: true become: true
become_user: "{{ brew_stat.stat.pw_name }}" become_user: "{{ brew_stat.stat.pw_name }}"
block: block:
- name: MACOS | Install black - name: MACOS | Install black
community.general.homebrew: community.general.homebrew:
name: black name: black
state: present state: present
register: install_result register: install_result
notify: notify:
- uninstall black - uninstall black
- name: Check the black service is installed - name: Check the black service is installed
assert: assert:
that: that:
- install_result is success - install_result is success
- name: Start the black service - name: Start the black service
community.general.homebrew_services: community.general.homebrew_services:
name: black name: black
state: present state: present
register: start_result register: start_result
environment: environment:
HOMEBREW_NO_ENV_HINTS: "1" HOMEBREW_NO_ENV_HINTS: "1"
- name: Check the black service is running - name: Check the black service is running
assert: assert:
that: that:
- start_result is success - start_result is success
- name: Start the black service when already started - name: Start the black service when already started
community.general.homebrew_services: community.general.homebrew_services:
name: black name: black
state: present state: present
register: start_result register: start_result
environment: environment:
HOMEBREW_NO_ENV_HINTS: "1" HOMEBREW_NO_ENV_HINTS: "1"
- name: Check for idempotency - name: Check for idempotency
assert: assert:
that: that:
- start_result.changed == 0 - start_result.changed == 0
- name: Restart the black service - name: Restart the black service
community.general.homebrew_services: community.general.homebrew_services:
name: black name: black
state: restarted state: restarted
register: restart_result register: restart_result
environment: environment:
HOMEBREW_NO_ENV_HINTS: "1" HOMEBREW_NO_ENV_HINTS: "1"
- name: Check the black service is restarted - name: Check the black service is restarted
assert: assert:
that: that:
- restart_result is success - restart_result is success
- name: Stop the black service - name: Stop the black service
community.general.homebrew_services: community.general.homebrew_services:
name: black name: black
state: present state: present
register: stop_result register: stop_result
environment: environment:
HOMEBREW_NO_ENV_HINTS: "1" HOMEBREW_NO_ENV_HINTS: "1"
- name: Check the black service is stopped - name: Check the black service is stopped
assert: assert:
that: that:
- stop_result is success - stop_result is success

View file

@ -62,7 +62,7 @@
root_volume: root_volume:
volume_type: "SAS" volume_type: "SAS"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a instance (check mode) - name: create a instance (check mode)
hwc_ecs_instance: hwc_ecs_instance:
data_volumes: data_volumes:
@ -90,7 +90,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a instance - name: create a instance
hwc_ecs_instance: hwc_ecs_instance:
data_volumes: data_volumes:
@ -117,7 +117,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a instance (idemponent) - name: create a instance (idemponent)
hwc_ecs_instance: hwc_ecs_instance:
data_volumes: data_volumes:
@ -173,7 +173,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a instance (check mode) - name: delete a instance (check mode)
hwc_ecs_instance: hwc_ecs_instance:
data_volumes: data_volumes:
@ -201,7 +201,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a instance - name: delete a instance
hwc_ecs_instance: hwc_ecs_instance:
data_volumes: data_volumes:
@ -228,7 +228,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a instance (idemponent) - name: delete a instance (idemponent)
hwc_ecs_instance: hwc_ecs_instance:
data_volumes: data_volumes:
@ -283,7 +283,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a disk - name: delete a disk
hwc_evs_disk: hwc_evs_disk:

View file

@ -15,7 +15,7 @@
volume_type: "SATA" volume_type: "SATA"
size: 10 size: 10
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a disk - name: create a disk
hwc_evs_disk: hwc_evs_disk:
availability_zone: "cn-north-1a" availability_zone: "cn-north-1a"
@ -56,7 +56,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a disk (check mode) - name: delete a disk (check mode)
hwc_evs_disk: hwc_evs_disk:
availability_zone: "cn-north-1a" availability_zone: "cn-north-1a"
@ -70,7 +70,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a disk - name: delete a disk
hwc_evs_disk: hwc_evs_disk:
availability_zone: "cn-north-1a" availability_zone: "cn-north-1a"

View file

@ -24,27 +24,27 @@
# Pre-test setup # Pre-test setup
- name: delete a vpc - name: delete a vpc
hwc_network_vpc: hwc_network_vpc:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "vpc_1" name: "vpc_1"
cidr: "192.168.100.0/24" cidr: "192.168.100.0/24"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a vpc - name: create a vpc
hwc_network_vpc: hwc_network_vpc:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "vpc_1" name: "vpc_1"
cidr: "192.168.100.0/24" cidr: "192.168.100.0/24"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -53,33 +53,33 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a vpc that already exists - name: create a vpc that already exists
hwc_network_vpc: hwc_network_vpc:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "vpc_1" name: "vpc_1"
cidr: "192.168.100.0/24" cidr: "192.168.100.0/24"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a vpc - name: delete a vpc
hwc_network_vpc: hwc_network_vpc:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "vpc_1" name: "vpc_1"
cidr: "192.168.100.0/24" cidr: "192.168.100.0/24"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -88,15 +88,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a vpc that does not exist - name: delete a vpc that does not exist
hwc_network_vpc: hwc_network_vpc:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "vpc_1" name: "vpc_1"
cidr: "192.168.100.0/24" cidr: "192.168.100.0/24"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:

View file

@ -10,25 +10,25 @@
- name: delete a smn topic - name: delete a smn topic
hwc_smn_topic: hwc_smn_topic:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "ansible_smn_topic_test" name: "ansible_smn_topic_test"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a smn topic - name: create a smn topic
hwc_smn_topic: hwc_smn_topic:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "ansible_smn_topic_test" name: "ansible_smn_topic_test"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -37,31 +37,31 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a smn topic that already exists - name: create a smn topic that already exists
hwc_smn_topic: hwc_smn_topic:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "ansible_smn_topic_test" name: "ansible_smn_topic_test"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a smn topic - name: delete a smn topic
hwc_smn_topic: hwc_smn_topic:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "ansible_smn_topic_test" name: "ansible_smn_topic_test"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -70,14 +70,14 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a smn topic that does not exist - name: delete a smn topic that does not exist
hwc_smn_topic: hwc_smn_topic:
identity_endpoint: "{{ identity_endpoint }}" identity_endpoint: "{{ identity_endpoint }}"
user: "{{ user }}" user: "{{ user }}"
password: "{{ password }}" password: "{{ password }}"
domain: "{{ domain }}" domain: "{{ domain }}"
project: "{{ project }}" project: "{{ project }}"
region: "{{ region }}" region: "{{ region }}"
name: "ansible_smn_topic_test" name: "ansible_smn_topic_test"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:

View file

@ -39,7 +39,7 @@
size: 1 size: 1
port_id: "{{ port.id }}" port_id: "{{ port.id }}"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a eip (check mode) - name: create a eip (check mode)
hwc_vpc_eip: hwc_vpc_eip:
type: "5_bgp" type: "5_bgp"
@ -55,7 +55,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a eip - name: create a eip
hwc_vpc_eip: hwc_vpc_eip:
type: "5_bgp" type: "5_bgp"
@ -70,7 +70,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a eip (idemponent) - name: create a eip (idemponent)
hwc_vpc_eip: hwc_vpc_eip:
type: "5_bgp" type: "5_bgp"
@ -102,7 +102,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a eip (check mode) - name: delete a eip (check mode)
hwc_vpc_eip: hwc_vpc_eip:
type: "5_bgp" type: "5_bgp"
@ -118,7 +118,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a eip - name: delete a eip
hwc_vpc_eip: hwc_vpc_eip:
type: "5_bgp" type: "5_bgp"
@ -133,7 +133,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a eip (idemponent) - name: delete a eip (idemponent)
hwc_vpc_eip: hwc_vpc_eip:
type: "5_bgp" type: "5_bgp"
@ -165,7 +165,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a port - name: delete a port
hwc_vpc_port: hwc_vpc_port:

View file

@ -28,7 +28,7 @@
peering_vpc: peering_vpc:
vpc_id: "{{ vpc2.id }}" vpc_id: "{{ vpc2.id }}"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a peering connect (check mode) - name: create a peering connect (check mode)
hwc_vpc_peering_connect: hwc_vpc_peering_connect:
local_vpc_id: "{{ vpc1.id }}" local_vpc_id: "{{ vpc1.id }}"
@ -43,7 +43,7 @@
that: that:
- not result.id - not result.id
- result.changed - result.changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a peering connect - name: create a peering connect
hwc_vpc_peering_connect: hwc_vpc_peering_connect:
local_vpc_id: "{{ vpc1.id }}" local_vpc_id: "{{ vpc1.id }}"
@ -56,7 +56,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a peering connect (idemponent) - name: create a peering connect (idemponent)
hwc_vpc_peering_connect: hwc_vpc_peering_connect:
local_vpc_id: "{{ vpc1.id }}" local_vpc_id: "{{ vpc1.id }}"
@ -84,7 +84,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a peering connect (check mode) - name: delete a peering connect (check mode)
hwc_vpc_peering_connect: hwc_vpc_peering_connect:
local_vpc_id: "{{ vpc1.id }}" local_vpc_id: "{{ vpc1.id }}"
@ -98,7 +98,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a peering connect - name: delete a peering connect
hwc_vpc_peering_connect: hwc_vpc_peering_connect:
local_vpc_id: "{{ vpc1.id }}" local_vpc_id: "{{ vpc1.id }}"
@ -111,7 +111,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a peering connect (idemponent) - name: delete a peering connect (idemponent)
hwc_vpc_peering_connect: hwc_vpc_peering_connect:
local_vpc_id: "{{ vpc1.id }}" local_vpc_id: "{{ vpc1.id }}"
@ -139,7 +139,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a vpc - name: delete a vpc
hwc_network_vpc: hwc_network_vpc:

View file

@ -29,7 +29,7 @@
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
ip_address: "192.168.100.33" ip_address: "192.168.100.33"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a port (check mode) - name: create a port (check mode)
hwc_vpc_port: hwc_vpc_port:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -41,7 +41,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a port - name: create a port
hwc_vpc_port: hwc_vpc_port:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -52,7 +52,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a port (idemponent) - name: create a port (idemponent)
hwc_vpc_port: hwc_vpc_port:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -75,7 +75,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a port (check mode) - name: delete a port (check mode)
hwc_vpc_port: hwc_vpc_port:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -87,7 +87,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a port - name: delete a port
hwc_vpc_port: hwc_vpc_port:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -98,7 +98,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a port (idemponent) - name: delete a port (idemponent)
hwc_vpc_port: hwc_vpc_port:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -122,7 +122,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a subnet - name: delete a subnet
hwc_vpc_subnet: hwc_vpc_subnet:

View file

@ -29,7 +29,7 @@
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
ip_address: "192.168.100.33" ip_address: "192.168.100.33"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a private ip (check mode) - name: create a private ip (check mode)
hwc_vpc_private_ip: hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -41,7 +41,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a private ip - name: create a private ip
hwc_vpc_private_ip: hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -52,7 +52,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a private ip (idemponent) - name: create a private ip (idemponent)
hwc_vpc_private_ip: hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -76,7 +76,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a private ip (check mode) - name: delete a private ip (check mode)
hwc_vpc_private_ip: hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -88,7 +88,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a private ip - name: delete a private ip
hwc_vpc_private_ip: hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -99,7 +99,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a private ip (idemponent) - name: delete a private ip (idemponent)
hwc_vpc_private_ip: hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}" subnet_id: "{{ subnet.id }}"
@ -123,7 +123,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a subnet - name: delete a subnet
hwc_vpc_subnet: hwc_vpc_subnet:

View file

@ -37,7 +37,7 @@
destination: "192.168.0.0/16" destination: "192.168.0.0/16"
next_hop: "{{ connect.id }}" next_hop: "{{ connect.id }}"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a route (check mode) - name: create a route (check mode)
hwc_vpc_route: hwc_vpc_route:
vpc_id: "{{ vpc1.id }}" vpc_id: "{{ vpc1.id }}"
@ -49,7 +49,7 @@
that: that:
- not result.id - not result.id
- result.changed - result.changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a route - name: create a route
hwc_vpc_route: hwc_vpc_route:
vpc_id: "{{ vpc1.id }}" vpc_id: "{{ vpc1.id }}"
@ -87,7 +87,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a route (check mode) - name: delete a route (check mode)
hwc_vpc_route: hwc_vpc_route:
vpc_id: "{{ vpc1.id }}" vpc_id: "{{ vpc1.id }}"
@ -95,7 +95,7 @@
next_hop: "{{ connect.id }}" next_hop: "{{ connect.id }}"
state: absent state: absent
check_mode: true check_mode: true
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a route - name: delete a route
hwc_vpc_route: hwc_vpc_route:
vpc_id: "{{ vpc1.id }}" vpc_id: "{{ vpc1.id }}"
@ -107,7 +107,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a (idemponent) - name: delete a (idemponent)
hwc_vpc_route: hwc_vpc_route:
vpc_id: "{{ vpc1.id }}" vpc_id: "{{ vpc1.id }}"
@ -133,7 +133,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a peering connect - name: delete a peering connect
hwc_vpc_peering_connect: hwc_vpc_peering_connect:

View file

@ -13,7 +13,7 @@
hwc_vpc_security_group: hwc_vpc_security_group:
name: "ansible_network_security_group_test" name: "ansible_network_security_group_test"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a security group (check mode) - name: create a security group (check mode)
hwc_vpc_security_group: hwc_vpc_security_group:
name: "ansible_network_security_group_test" name: "ansible_network_security_group_test"
@ -25,7 +25,7 @@
that: that:
- not result.id - not result.id
- result.changed - result.changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a security group - name: create a security group
hwc_vpc_security_group: hwc_vpc_security_group:
name: "ansible_network_security_group_test" name: "ansible_network_security_group_test"
@ -35,7 +35,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a security group (idemponent) - name: create a security group (idemponent)
hwc_vpc_security_group: hwc_vpc_security_group:
name: "ansible_network_security_group_test" name: "ansible_network_security_group_test"
@ -57,7 +57,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a security group (check mode) - name: delete a security group (check mode)
hwc_vpc_security_group: hwc_vpc_security_group:
name: "ansible_network_security_group_test" name: "ansible_network_security_group_test"
@ -68,7 +68,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a security group - name: delete a security group
hwc_vpc_security_group: hwc_vpc_security_group:
name: "ansible_network_security_group_test" name: "ansible_network_security_group_test"

View file

@ -24,7 +24,7 @@
port_range_min: 22 port_range_min: 22
remote_ip_prefix: "0.0.0.0/0" remote_ip_prefix: "0.0.0.0/0"
state: absent state: absent
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a security group rule (check mode) - name: create a security group rule (check mode)
hwc_vpc_security_group_rule: hwc_vpc_security_group_rule:
direction: "ingress" direction: "ingress"
@ -42,7 +42,7 @@
that: that:
- not result.id - not result.id
- result.changed - result.changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a security group rule - name: create a security group rule
hwc_vpc_security_group_rule: hwc_vpc_security_group_rule:
direction: "ingress" direction: "ingress"
@ -58,7 +58,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: create a security group rule (idemponent) - name: create a security group rule (idemponent)
hwc_vpc_security_group_rule: hwc_vpc_security_group_rule:
direction: "ingress" direction: "ingress"
@ -91,7 +91,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a security group rule (check mode) - name: delete a security group rule (check mode)
hwc_vpc_security_group_rule: hwc_vpc_security_group_rule:
direction: "ingress" direction: "ingress"
@ -108,7 +108,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a security group rule - name: delete a security group rule
hwc_vpc_security_group_rule: hwc_vpc_security_group_rule:
direction: "ingress" direction: "ingress"
@ -124,7 +124,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ----------------------------------------------------------
- name: delete a security group rule (idemponent) - name: delete a security group rule (idemponent)
hwc_vpc_security_group_rule: hwc_vpc_security_group_rule:
direction: "ingress" direction: "ingress"
@ -157,7 +157,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # ---------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a security group - name: delete a security group
hwc_vpc_security_group: hwc_vpc_security_group:

View file

@ -23,7 +23,7 @@
name: "ansible_network_subnet_test" name: "ansible_network_subnet_test"
dhcp_enable: true dhcp_enable: true
state: absent state: absent
#---------------------------------------------------------- # ---------------------------------------------------------
- name: create a subnet (check mode) - name: create a subnet (check mode)
hwc_vpc_subnet: hwc_vpc_subnet:
vpc_id: "{{ vpc.id }}" vpc_id: "{{ vpc.id }}"
@ -39,7 +39,7 @@
that: that:
- not result.id - not result.id
- result.changed - result.changed
#---------------------------------------------------------- # ---------------------------------------------------------
- name: create a subnet - name: create a subnet
hwc_vpc_subnet: hwc_vpc_subnet:
vpc_id: "{{ vpc.id }}" vpc_id: "{{ vpc.id }}"
@ -53,7 +53,7 @@
assert: assert:
that: that:
result is changed result is changed
#---------------------------------------------------------- # ---------------------------------------------------------
- name: create a subnet (idemponent) - name: create a subnet (idemponent)
hwc_vpc_subnet: hwc_vpc_subnet:
vpc_id: "{{ vpc.id }}" vpc_id: "{{ vpc.id }}"
@ -83,7 +83,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#---------------------------------------------------------- # ---------------------------------------------------------
- name: delete a subnet (check mode) - name: delete a subnet (check mode)
hwc_vpc_subnet: hwc_vpc_subnet:
vpc_id: "{{ vpc.id }}" vpc_id: "{{ vpc.id }}"
@ -98,7 +98,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ---------------------------------------------------------
- name: delete a subnet - name: delete a subnet
hwc_vpc_subnet: hwc_vpc_subnet:
vpc_id: "{{ vpc.id }}" vpc_id: "{{ vpc.id }}"
@ -112,7 +112,7 @@
assert: assert:
that: that:
- result is changed - result is changed
#---------------------------------------------------------- # ---------------------------------------------------------
- name: delete a subnet (idemponent) - name: delete a subnet (idemponent)
hwc_vpc_subnet: hwc_vpc_subnet:
vpc_id: "{{ vpc.id }}" vpc_id: "{{ vpc.id }}"
@ -142,7 +142,7 @@
that: that:
- result is not failed - result is not failed
- result is not changed - result is not changed
#--------------------------------------------------------- # --------------------------------------------------------
# Post-test teardown # Post-test teardown
- name: delete a vpc - name: delete a vpc
hwc_network_vpc: hwc_network_vpc:

View file

@ -4,21 +4,21 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
- block: &prepare - block: &prepare
- name: Create the final file - name: Create the final file
ansible.builtin.copy: ansible.builtin.copy:
content: | content: |
[main] [main]
foo=BAR foo=BAR
dest: "{{ remote_tmp_dir }}/my_original_file.ini" dest: "{{ remote_tmp_dir }}/my_original_file.ini"
- name: Clean up symlink.ini - name: Clean up symlink.ini
ansible.builtin.file: ansible.builtin.file:
path: "{{ remote_tmp_dir }}/symlink.ini" path: "{{ remote_tmp_dir }}/symlink.ini"
state: absent state: absent
- name: Create a symbolic link - name: Create a symbolic link
ansible.builtin.file: ansible.builtin.file:
src: my_original_file.ini src: my_original_file.ini
dest: "{{ remote_tmp_dir }}/symlink.ini" dest: "{{ remote_tmp_dir }}/symlink.ini"
state: link state: link
- name: Set the proxy key on the symlink which will be converted as a file - name: Set the proxy key on the symlink which will be converted as a file
community.general.ini_file: community.general.ini_file:

View file

@ -68,7 +68,7 @@
- name: test-modify_inactive_option 2 - read content from output file - name: test-modify_inactive_option 2 - read content from output file
slurp: slurp:
src: "{{ output_file }}" src: "{{ output_file }}"
register: output_content register: output_content
- name: test-modify_inactive_option 2 - set expected content and get current ini file content - name: test-modify_inactive_option 2 - set expected content and get current ini file content
@ -144,7 +144,7 @@
- name: test-modify_inactive_option 4 - read content from output file - name: test-modify_inactive_option 4 - read content from output file
slurp: slurp:
src: "{{ output_file }}" src: "{{ output_file }}"
register: output_content register: output_content
- name: test-modify_inactive_option 4 - set expected content and get current ini file content - name: test-modify_inactive_option 4 - set expected content and get current ini file content

View file

@ -24,7 +24,7 @@
- assert: - assert:
that: that:
- ifile_1 is changed - ifile_1 is changed
- name: Change IP address to 1.2.3.5 again - name: Change IP address to 1.2.3.5 again
community.general.interfaces_file: community.general.interfaces_file:
@ -36,7 +36,7 @@
- assert: - assert:
that: that:
- ifile_2 is not changed - ifile_2 is not changed
- name: 3841 - copy interfaces file - name: 3841 - copy interfaces file
copy: copy:

Some files were not shown because too many files have changed in this diff Show more