Adding field change to readme and example and test of custom messages

This commit is contained in:
John Westcott IV 2020-03-31 11:46:28 -04:00 committed by beeankha
parent 649aafb454
commit eb4db4ed43
3 changed files with 25 additions and 1 deletions

View File

@ -51,6 +51,7 @@ The following notes are changes that may require changes to playbooks:
- Specified `tower_config` file used to handle `k=v` pairs on a single line; this is no longer supported. Please use a file formatted as `yaml`, `json` or `ini` only.
- Some return values (e.g., `credential_type`) have been removed. Use of `id` is recommended.
- `tower_job_template` no longer supports the deprecated `extra_vars_path` parameter, please use `extra_vars` with the lookup plugin to replace this functionality.
- `notification_configration` parameter of `tower_notification` has changed from a string to a dict. Please use the `lookup` plugin to read an existing file into a dict.
## Running Unit Tests

View File

@ -229,6 +229,7 @@ EXAMPLES = '''
- name: Add Slack notification
tower_notification:
name: slack notification
organization: Default
notification_type: slack
channels:
- general
@ -236,6 +237,20 @@ EXAMPLES = '''
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add custom messages to our notification
tower_notification:
name: slack notification
notification_type: slack
organization: Default
messages:
started:
message: "{{ '{{' }} job_friendly_name {{' }}' }} {{ '{{' }} job.id {{' }}' }} started"
success:
message: "{{ '{{' }} job_friendly_name {{ '}}' }} completed in {{ '{{' }} job.elapsed {{ '}}' }} seconds"
error:
message: "{{ '{{' }} job_friendly_name {{ '}}' }} FAILED! Please look at {{ '{{' }} job.url {{ '}}' }}"
tower_config_file: "~/tower_cli.cfg"
- name: Add webhook notification
tower_notification:
name: webhook notification
@ -319,6 +334,7 @@ EXAMPLES = '''
notification_type: email
state: absent
tower_config_file: "~/tower_cli.cfg"
'''

View File

@ -66,7 +66,7 @@
# The 27 can be count from the size of the OLD_INPUT_NAMES list in the module
- result['deprecations'] | length() == 27
- name: Create Slack notification
- name: Create Slack notification with custom messages
tower_notification:
name: "{{ slack_not }}"
organization: Default
@ -74,6 +74,13 @@
token: a_token
channels:
- general
messages:
started:
message: "{{ '{{' }} job_friendly_name {{' }}' }} {{ '{{' }} job.id {{' }}' }} started"
success:
message: "{{ '{{' }} job_friendly_name {{ '}}' }} completed in {{ '{{' }} job.elapsed {{ '}}' }} seconds"
error:
message: "{{ '{{' }} job_friendly_name {{ '}}' }} FAILED! Please look at {{ '{{' }} job.url {{ '}}' }}"
state: present
register: result