Change module from tower_notification to tower_notification_template

This commit is contained in:
John Westcott IV 2020-08-24 13:59:05 -04:00
parent f8290f0ce3
commit b1ffbf1e39
4 changed files with 35 additions and 27 deletions

View File

@ -13,3 +13,5 @@ plugin_routing:
deprecation:
removal_date: TBD
warning_text: see plugin documentation for details
tower_notifitcation:
redirect: tower_notification_template

View File

@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: tower_notification
module: tower_notification_template
author: "Samuel Carpentier (@samcarpentier)"
short_description: create, update, or destroy Ansible Tower notification.
description:
@ -203,7 +203,7 @@ extends_documentation_fragment: awx.awx.auth
EXAMPLES = '''
- name: Add Slack notification with custom messages
tower_notification:
tower_notification_template:
name: slack notification
organization: Default
notification_type: slack
@ -222,7 +222,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
- name: Add webhook notification
tower_notification:
tower_notification_template:
name: webhook notification
notification_type: webhook
notification_configuration:
@ -233,7 +233,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
- name: Add email notification
tower_notification:
tower_notification_template:
name: email notification
notification_type: email
notification_configuration:
@ -250,7 +250,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
- name: Add twilio notification
tower_notification:
tower_notification_template:
name: twilio notification
notification_type: twilio
notification_configuration:
@ -263,7 +263,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
- name: Add PagerDuty notification
tower_notification:
tower_notification_template:
name: pagerduty notification
notification_type: pagerduty
notification_configuration:
@ -275,7 +275,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
- name: Add IRC notification
tower_notification:
tower_notification_template:
name: irc notification
notification_type: irc
notification_configuration:
@ -290,7 +290,7 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg"
- name: Delete notification
tower_notification:
tower_notification_template:
name: old notification
state: absent
tower_config_file: "~/tower_cli.cfg"

View File

@ -59,6 +59,12 @@ no_api_parameter_ok = {
'tower_workflow_job_template_node': ['always_nodes', 'failure_nodes', 'success_nodes', 'credentials', 'organization'],
# Survey is how we handle associations
'tower_workflow_job_template': ['survey'],
# These fields get wrapped into notification_configuration
'tower_notification_template': [
'account_sid', 'account_token', 'channels', 'client_name', 'color', 'from_number', 'headers', 'host',
'message_from', 'nickname', 'notify', 'password', 'port', 'recipients', 'sender', 'server',
'service_key', 'subdomain', 'targets', 'to_numbers', 'token', 'url', 'use_ssl', 'use_tls', 'username',
]
}
# When this tool was created we were not feature complete. Adding something in here indicates a module

View File

@ -1,14 +1,14 @@
---
- name: Generate names
set_fact:
slack_not: "AWX-Collection-tests-tower_notification-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
webhook_not: "AWX-Collection-tests-tower_notification-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
email_not: "AWX-Collection-tests-tower_notification-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
twillo_not: "AWX-Collection-tests-tower_notification-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
pd_not: "AWX-Collection-tests-tower_notification-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
irc_not: "AWX-Collection-tests-tower_notification-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
slack_not: "AWX-Collection-tests-tower_notification_template-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
email_not: "AWX-Collection-tests-tower_notification_template-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
twillo_not: "AWX-Collection-tests-tower_notification_template-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
pd_not: "AWX-Collection-tests-tower_notification_template-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
irc_not: "AWX-Collection-tests-tower_notification_template-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Test deprecation warnings
- name: Test deprecation warnings with legacy name
tower_notification:
name: "{{ slack_not }}"
organization: Default
@ -54,7 +54,7 @@
- result['deprecations'] | length() == 25
- name: Create Slack notification with custom messages
tower_notification:
tower_notification_template:
name: "{{ slack_not }}"
organization: Default
notification_type: slack
@ -76,7 +76,7 @@
- result is changed
- name: Delete Slack notification
tower_notification:
tower_notification_template:
name: "{{ slack_not }}"
organization: Default
state: absent
@ -87,7 +87,7 @@
- result is changed
- name: Add webhook notification
tower_notification:
tower_notification_template:
name: "{{ webhook_not }}"
organization: Default
notification_type: webhook
@ -102,7 +102,7 @@
- result is changed
- name: Delete webhook notification
tower_notification:
tower_notification_template:
name: "{{ webhook_not }}"
organization: Default
state: absent
@ -113,7 +113,7 @@
- result is changed
- name: Add email notification
tower_notification:
tower_notification_template:
name: "{{ email_not }}"
organization: Default
notification_type: email
@ -134,7 +134,7 @@
- result is changed
- name: Delete email notification
tower_notification:
tower_notification_template:
name: "{{ email_not }}"
organization: Default
state: absent
@ -145,7 +145,7 @@
- result is changed
- name: Add twilio notification
tower_notification:
tower_notification_template:
name: "{{ twillo_not }}"
organization: Default
notification_type: twilio
@ -162,7 +162,7 @@
- result is changed
- name: Delete twilio notification
tower_notification:
tower_notification_template:
name: "{{ twillo_not }}"
organization: Default
state: absent
@ -173,7 +173,7 @@
- result is changed
- name: Add PagerDuty notification
tower_notification:
tower_notification_template:
name: "{{ pd_not }}"
organization: Default
notification_type: pagerduty
@ -189,7 +189,7 @@
- result is changed
- name: Delete PagerDuty notification
tower_notification:
tower_notification_template:
name: "{{ pd_not }}"
organization: Default
state: absent
@ -200,7 +200,7 @@
- result is changed
- name: Add IRC notification
tower_notification:
tower_notification_template:
name: "{{ irc_not }}"
organization: Default
notification_type: irc
@ -219,7 +219,7 @@
- result is changed
- name: Delete IRC notification
tower_notification:
tower_notification_template:
name: "{{ irc_not }}"
organization: Default
state: absent