Prepare main for 13.0.0 (#11834)

* Bump version to 13.0.0.

* Remove deprecated modules and plugins.

* Remove deprecated module utils.

* Remove leftovers.

* Remove mode=compatibility.

* Change default of is_pre740 from true to false.

* Change default of force_defaults from true to false.

* Remove support for ubuntu_legacy mechanism.

* Remove cpanm compatibility tests.
This commit is contained in:
Felix Fontein
2026-04-20 12:35:43 +02:00
committed by GitHub
parent 7ce198f0e7
commit 72c13c85ad
62 changed files with 104 additions and 13052 deletions

View File

@@ -1,6 +0,0 @@
# Copyright (c) Ansible Project
# 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
azp/posix/1
needs/root

View File

@@ -1,179 +0,0 @@
---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) Ansible Project
# 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
- name: Creating a client if the directory doesn't exist should work
sensu_client:
subscriptions:
- default
- name: Set variable for client file
set_fact:
client_file: "/etc/sensu/conf.d/client.json"
- name: Insert invalid JSON in the client file
lineinfile:
state: "present"
create: "yes"
path: "{{ client_file }}"
line: "{'foo' = bar}"
- name: Configure Sensu client with an existing invalid file
sensu_client:
name: "client"
state: "present"
subscriptions:
- default
register: client
- name: Retrieve configuration file
slurp:
src: "{{ client_file }}"
register: client_config
- name: Assert that client data was set successfully and properly
assert:
that:
- "client is successful"
- "client is changed"
- "client['config']['name'] == 'client'"
- "'default' in client['config']['subscriptions']"
- "client['file'] == client_file"
- name: Assert that the client configuration file is actually configured properly
vars:
config: "{{ client_config.content | b64decode | from_json }}"
assert:
that:
- "config['client']['keepalives'] == true"
- "config['client']['name'] == 'client'"
- "config['client']['safe_mode'] == false"
- "'default' in config['client']['subscriptions']"
- name: Delete Sensu client configuration
sensu_client:
state: "absent"
register: client_delete
- name: Delete Sensu client configuration (again)
sensu_client:
state: "absent"
register: client_delete_twice
- name: Retrieve configuration file stat
stat:
path: "{{ client_file }}"
register: client_stat
- name: Assert that client deletion was successful
assert:
that:
- "client_delete is successful"
- "client_delete is changed"
- "client_delete_twice is successful"
- "client_delete_twice is not changed"
- "client_stat.stat.exists == false"
- name: Configuring a client without subscriptions should fail
sensu_client:
name: "failure"
register: failure
ignore_errors: true
- name: Assert failure to create client
assert:
that:
- failure is failed
- "'the following are missing: subscriptions' in failure['msg']"
- name: Configure a new client from scratch with custom parameters
sensu_client:
name: "custom"
address: "host.fqdn"
subscriptions:
- "default"
- "webserver"
redact:
- "password"
socket:
bind: "127.0.0.1"
port: "3030"
keepalive:
thresholds:
warning: "180"
critical: "300"
handlers:
- "email"
custom:
- broadcast: "irc"
occurrences: "3"
register: client
- name: Configure a new client from scratch with custom parameters (twice)
sensu_client:
name: "custom"
address: "host.fqdn"
subscriptions:
- "default"
- "webserver"
redact:
- "password"
socket:
bind: "127.0.0.1"
port: "3030"
keepalive:
thresholds:
warning: "180"
critical: "300"
handlers:
- "email"
custom:
- broadcast: "irc"
occurrences: "3"
register: client_twice
- name: Retrieve configuration file
slurp:
src: "{{ client_file }}"
register: client_config
- name: Assert that client data was set successfully and properly
assert:
that:
- "client is successful"
- "client is changed"
- "client_twice is successful"
- "client_twice is not changed"
- "client['config']['name'] == 'custom'"
- "client['config']['address'] == 'host.fqdn'"
- "'default' in client['config']['subscriptions']"
- "'webserver' in client['config']['subscriptions']"
- "'password' in client['config']['redact']"
- "client['config']['keepalive']['thresholds']['warning'] == '180'"
- "client['config']['keepalive']['thresholds']['critical'] == '300'"
- "'email' in client['config']['keepalive']['handlers']"
- "client['config']['keepalive']['occurrences'] == '3'"
- "client['file'] == client_file"
- name: Assert that the client configuration file is actually configured properly
vars:
config: "{{ client_config.content | b64decode | from_json }}"
assert:
that:
- "config['client']['name'] == 'custom'"
- "config['client']['address'] == 'host.fqdn'"
- "config['client']['keepalives'] == true"
- "config['client']['safe_mode'] == false"
- "'default' in config['client']['subscriptions']"
- "'webserver' in config['client']['subscriptions']"
- "'password' in config['client']['redact']"
- "config['client']['keepalive']['thresholds']['warning'] == '180'"
- "config['client']['keepalive']['thresholds']['critical'] == '300'"
- "'email' in config['client']['keepalive']['handlers']"
- "config['client']['keepalive']['occurrences'] == '3'"

View File

@@ -1,6 +0,0 @@
# Copyright (c) Ansible Project
# 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
azp/posix/1
needs/root

View File

@@ -1,129 +0,0 @@
---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) Ansible Project
# 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
- name: Creating a handler if the directory doesn't exist should work
sensu_handler:
name: "handler"
type: "pipe"
command: "/bin/bash"
state: "present"
- name: Insert junk JSON in a handlers file
lineinfile:
state: "present"
create: "yes"
path: "/etc/sensu/conf.d/handlers/handler.json"
line: "{'foo' = bar}"
- name: Configure a handler with an existing invalid file
sensu_handler:
name: "handler"
type: "pipe"
command: "/bin/bash"
state: "present"
register: handler
- name: Configure a handler (again)
sensu_handler:
name: "handler"
type: "pipe"
command: "/bin/bash"
state: "present"
register: handler_twice
- name: Retrieve configuration file
slurp:
src: "{{ handler['file'] }}"
register: handler_config
- name: Assert that handler data was set successfully and properly
assert:
that:
- "handler is successful"
- "handler is changed"
- "handler_twice is successful"
- "handler_twice is not changed"
- "handler['name'] == 'handler'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/handler.json'"
- "handler['config']['type'] == 'pipe'"
- "handler['config']['command'] == '/bin/bash'"
- "handler['config']['timeout'] == 10"
- "handler['config']['handle_flapping'] == false"
- "handler['config']['handle_silenced'] == false"
- name: Assert that the handler configuration file is actually configured properly
vars:
config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'handler' in config['handlers']"
- "config['handlers']['handler']['type'] == 'pipe'"
- "config['handlers']['handler']['command'] == '/bin/bash'"
- "config['handlers']['handler']['timeout'] == 10"
- "config['handlers']['handler']['handle_flapping'] == false"
- "config['handlers']['handler']['handle_silenced'] == false"
- name: Delete Sensu handler configuration
sensu_handler:
name: "handler"
state: "absent"
register: handler_delete
- name: Delete Sensu handler configuration (again)
sensu_handler:
name: "handler"
state: "absent"
register: handler_delete_twice
- name: Retrieve configuration file stat
stat:
path: "{{ handler['file'] }}"
register: handler_stat
- name: Assert that handler deletion was successful
assert:
that:
- "handler_delete is successful"
- "handler_delete is changed"
- "handler_delete_twice is successful"
- "handler_delete_twice is not changed"
- "handler_stat.stat.exists == false"
- name: Configuring a handler without a name should fail
sensu_handler:
type: "pipe"
command: "/bin/bash"
register: failure
ignore_errors: true
- name: Assert that configuring a handler without a name fails
assert:
that:
- failure is failed
- "'required arguments: name' in failure['msg']"
- name: Configuring a handler without a type should fail
sensu_handler:
name: "pipe"
command: "/bin/bash"
register: failure
ignore_errors: true
- name: Assert that configuring a handler without a type fails
assert:
that:
- failure is failed
- "'the following are missing: type' in failure['msg']"
- include_tasks: pipe.yml
- include_tasks: tcp.yml
- include_tasks: udp.yml
- include_tasks: set.yml
- include_tasks: transport.yml

View File

@@ -1,25 +0,0 @@
---
# Copyright (c) Ansible Project
# 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
# Note: Pipe handlers are also tested and used as part of basic main.yml coverage
- name: Configuring a handler with missing pipe parameters should fail
sensu_handler:
name: "pipe"
type: "pipe"
register: failure
ignore_errors: true
- name: Assert that configuring a handler with missing pipe parameters fails
assert:
that:
- failure is failed
- "'the following are missing: command' in failure['msg']"
- name: Configure a handler with pipe parameters
sensu_handler:
name: "pipe"
type: "pipe"
command: "/bin/bash"
register: handler

View File

@@ -1,53 +0,0 @@
---
# Copyright (c) Ansible Project
# 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
- name: Configuring a handler with missing set parameters should fail
sensu_handler:
name: "set"
type: "set"
register: failure
ignore_errors: true
- name: Assert that configuring a handler with missing set parameters fails
assert:
that:
- failure is failed
- "'the following are missing: handlers' in failure['msg']"
- name: Configure a set handler
sensu_handler:
name: "set"
type: "set"
handlers:
- anotherhandler
register: handler
- name: Retrieve configuration file
slurp:
src: "{{ handler['file'] }}"
register: handler_config
- name: Validate set handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- "handler['name'] == 'set'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/set.json'"
- "handler['config']['type'] == 'set'"
- "'anotherhandler' in handler['config']['handlers']"
- "handler['config']['handle_flapping'] == false"
- "handler['config']['handle_silenced'] == false"
- name: Assert that the handler configuration file is actually configured properly
vars:
config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'set' in config['handlers']"
- "config['handlers']['set']['type'] == 'set'"
- "'anotherhandler' in config['handlers']['set']['handlers']"
- "config['handlers']['set']['handle_flapping'] == false"
- "config['handlers']['set']['handle_silenced'] == false"

View File

@@ -1,56 +0,0 @@
---
# Copyright (c) Ansible Project
# 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
- name: Configuring a handler with missing tcp parameters should fail
sensu_handler:
name: "tcp"
type: "tcp"
register: failure
ignore_errors: true
- name: Assert that configuring a handler with missing tcp parameters fails
assert:
that:
- failure is failed
- "'the following are missing: socket' in failure['msg']"
- name: Configure a tcp handler
sensu_handler:
name: "tcp"
type: "tcp"
socket:
host: 127.0.0.1
port: 8000
register: handler
- name: Retrieve configuration file
slurp:
src: "{{ handler['file'] }}"
register: handler_config
- name: Validate tcp handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- "handler['name'] == 'tcp'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/tcp.json'"
- "handler['config']['type'] == 'tcp'"
- "handler['config']['socket']['host'] == '127.0.0.1'"
- "handler['config']['socket']['port'] == 8000"
- "handler['config']['handle_flapping'] == false"
- "handler['config']['handle_silenced'] == false"
- name: Assert that the handler configuration file is actually configured properly
vars:
config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'tcp' in config['handlers']"
- "config['handlers']['tcp']['type'] == 'tcp'"
- "config['handlers']['tcp']['socket']['host'] == '127.0.0.1'"
- "config['handlers']['tcp']['socket']['port'] == 8000"
- "config['handlers']['tcp']['handle_flapping'] == false"
- "config['handlers']['tcp']['handle_silenced'] == false"

View File

@@ -1,56 +0,0 @@
---
# Copyright (c) Ansible Project
# 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
- name: Configuring a handler with missing transport parameters should fail
sensu_handler:
name: "transport"
type: "transport"
register: failure
ignore_errors: true
- name: Assert that configuring a handler with missing transport parameters fails
assert:
that:
- failure is failed
- "'the following are missing: pipe' in failure['msg']"
- name: Configure a transport handler
sensu_handler:
name: "transport"
type: "transport"
pipe:
type: "topic"
name: "transport_handler"
register: handler
- name: Retrieve configuration file
slurp:
src: "{{ handler['file'] }}"
register: handler_config
- name: Validate transport handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- "handler['name'] == 'transport'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/transport.json'"
- "handler['config']['type'] == 'transport'"
- "handler['config']['pipe']['type'] == 'topic'"
- "handler['config']['pipe']['name'] == 'transport_handler'"
- "handler['config']['handle_flapping'] == false"
- "handler['config']['handle_silenced'] == false"
- name: Assert that the handler configuration file is actually configured properly
vars:
config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'transport' in config['handlers']"
- "config['handlers']['transport']['type'] == 'transport'"
- "config['handlers']['transport']['pipe']['type'] == 'topic'"
- "config['handlers']['transport']['pipe']['name'] == 'transport_handler'"
- "config['handlers']['transport']['handle_flapping'] == false"
- "config['handlers']['transport']['handle_silenced'] == false"

View File

@@ -1,56 +0,0 @@
---
# Copyright (c) Ansible Project
# 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
- name: Configuring a handler with missing udp parameters should fail
sensu_handler:
name: "udp"
type: "udp"
register: failure
ignore_errors: true
- name: Assert that configuring a handler with missing udp parameters fails
assert:
that:
- failure is failed
- "'the following are missing: socket' in failure['msg']"
- name: Configure a udp handler
sensu_handler:
name: "udp"
type: "udp"
socket:
host: 127.0.0.1
port: 8000
register: handler
- name: Retrieve configuration file
slurp:
src: "{{ handler['file'] }}"
register: handler_config
- name: Validate udp handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- "handler['name'] == 'udp'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/udp.json'"
- "handler['config']['type'] == 'udp'"
- "handler['config']['socket']['host'] == '127.0.0.1'"
- "handler['config']['socket']['port'] == 8000"
- "handler['config']['handle_flapping'] == false"
- "handler['config']['handle_silenced'] == false"
- name: Assert that the handler configuration file is actually configured properly
vars:
config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'udp' in config['handlers']"
- "config['handlers']['udp']['type'] == 'udp'"
- "config['handlers']['udp']['socket']['host'] == '127.0.0.1'"
- "config['handlers']['udp']['socket']['port'] == 8000"
- "config['handlers']['udp']['handle_flapping'] == false"
- "config['handlers']['udp']['handle_silenced'] == false"