ma*.py: normalize docs (#9389)

* ma*.py: normalize docs

* Update plugins/modules/matrix.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2024-12-27 01:40:55 +13:00 committed by GitHub
parent a99f72fc36
commit a9fca56374
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 596 additions and 639 deletions

View file

@ -9,27 +9,21 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
DOCUMENTATION = r"""
author:
- Dag Wieers (@dagwieers)
- Dag Wieers (@dagwieers)
module: mail
short_description: Send an email
description:
- This module is useful for sending emails from playbooks.
- One may wonder why automate sending emails? In complex environments
there are from time to time processes that cannot be automated, either
because you lack the authority to make it so, or because not everyone
agrees to a common approach.
- If you cannot automate a specific step, but the step is non-blocking,
sending out an email to the responsible party to make them perform their
part of the bargain is an elegant way to put the responsibility in
someone else's lap.
- Of course sending out a mail can be equally useful as a way to notify
one or more people in a team that a specific action has been
(successfully) taken.
- This module is useful for sending emails from playbooks.
- One may wonder why automate sending emails? In complex environments there are from time to time processes that cannot be automated, either
because you lack the authority to make it so, or because not everyone agrees to a common approach.
- If you cannot automate a specific step, but the step is non-blocking, sending out an email to the responsible party to make them perform their
part of the bargain is an elegant way to put the responsibility in someone else's lap.
- Of course sending out a mail can be equally useful as a way to notify one or more people in a team that a specific action has been (successfully)
taken.
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes
attributes:
check_mode:
support: none
@ -38,106 +32,105 @@ attributes:
options:
sender:
description:
- The email-address the mail is sent from. May contain address and phrase.
- The email-address the mail is sent from. May contain address and phrase.
type: str
default: root
aliases: [ from ]
aliases: [from]
to:
description:
- The email-address(es) the mail is being sent to.
- This is a list, which may contain address and phrase portions.
- The email-address(es) the mail is being sent to.
- This is a list, which may contain address and phrase portions.
type: list
elements: str
default: root
aliases: [ recipients ]
aliases: [recipients]
cc:
description:
- The email-address(es) the mail is being copied to.
- This is a list, which may contain address and phrase portions.
- The email-address(es) the mail is being copied to.
- This is a list, which may contain address and phrase portions.
type: list
elements: str
default: []
bcc:
description:
- The email-address(es) the mail is being 'blind' copied to.
- This is a list, which may contain address and phrase portions.
- The email-address(es) the mail is being 'blind' copied to.
- This is a list, which may contain address and phrase portions.
type: list
elements: str
default: []
subject:
description:
- The subject of the email being sent.
- The subject of the email being sent.
required: true
type: str
aliases: [ msg ]
aliases: [msg]
body:
description:
- The body of the email being sent.
- The body of the email being sent.
type: str
username:
description:
- If SMTP requires username.
- If SMTP requires username.
type: str
password:
description:
- If SMTP requires password.
- If SMTP requires password.
type: str
host:
description:
- The mail server.
- The mail server.
type: str
default: localhost
port:
description:
- The mail server port.
- This must be a valid integer between 1 and 65534
- The mail server port.
- This must be a valid integer between V(1) and V(65534).
type: int
default: 25
attach:
description:
- A list of pathnames of files to attach to the message.
- Attached files will have their content-type set to C(application/octet-stream).
- A list of pathnames of files to attach to the message.
- Attached files will have their content-type set to C(application/octet-stream).
type: list
elements: path
default: []
headers:
description:
- A list of headers which should be added to the message.
- Each individual header is specified as C(header=value) (see example below).
- A list of headers which should be added to the message.
- Each individual header is specified as V(header=value) (see example below).
type: list
elements: str
default: []
charset:
description:
- The character set of email being sent.
- The character set of email being sent.
type: str
default: utf-8
subtype:
description:
- The minor mime type, can be either V(plain) or V(html).
- The major type is always V(text).
- The minor mime type, can be either V(plain) or V(html).
- The major type is always V(text).
type: str
choices: [ html, plain ]
choices: [html, plain]
default: plain
secure:
description:
- If V(always), the connection will only send email if the connection is Encrypted.
If the server doesn't accept the encrypted connection it will fail.
- If V(try), the connection will attempt to setup a secure SSL/TLS session, before trying to send.
- If V(never), the connection will not attempt to setup a secure SSL/TLS session, before sending
- If V(starttls), the connection will try to upgrade to a secure SSL/TLS connection, before sending.
If it is unable to do so it will fail.
- If V(always), the connection will only send email if the connection is Encrypted. If the server does not accept the encrypted connection
it will fail.
- If V(try), the connection will attempt to setup a secure SSL/TLS session, before trying to send.
- If V(never), the connection will not attempt to setup a secure SSL/TLS session, before sending.
- If V(starttls), the connection will try to upgrade to a secure SSL/TLS connection, before sending. If it is unable to do so it will fail.
type: str
choices: [ always, never, starttls, try ]
choices: [always, never, starttls, try]
default: try
timeout:
description:
- Sets the timeout in seconds for connection attempts.
- Sets the timeout in seconds for connection attempts.
type: int
default: 20
ehlohost:
description:
- Allows for manual specification of host for EHLO.
- Allows for manual specification of host for EHLO.
type: str
version_added: 3.8.0
message_id_domain:
@ -147,9 +140,9 @@ options:
type: str
default: ansible
version_added: 8.2.0
'''
"""
EXAMPLES = r'''
EXAMPLES = r"""
- name: Example playbook sending mail to root
community.general.mail:
subject: System {{ ansible_hostname }} has been successfully provisioned.
@ -174,15 +167,15 @@ EXAMPLES = r'''
body: Hello, this is an e-mail. I hope you like it ;-)
from: jane@example.net (Jane Jolie)
to:
- John Doe <j.d@example.org>
- Suzie Something <sue@example.com>
- John Doe <j.d@example.org>
- Suzie Something <sue@example.com>
cc: Charlie Root <root@localhost>
attach:
- /etc/group
- /tmp/avatar2.png
- /etc/group
- /tmp/avatar2.png
headers:
- Reply-To=john@example.com
- X-Special="Something or other"
- Reply-To=john@example.com
- X-Special="Something or other"
charset: us-ascii
delegate_to: localhost
@ -222,7 +215,7 @@ EXAMPLES = r'''
subject: Ansible-report
body: System {{ ansible_hostname }} has been successfully provisioned.
secure: starttls
'''
"""
import os
import smtplib