Community.general.mail
The community.general.mail
module in Ansible is used to manage email accounts, email aliases, and email forwarding. It provides a set of tasks and handlers that can be used to configure email services on a Linux system.
Here are some examples of what you can do with the community.general.mail
module:
- Create an email account: You can use the
mail_user
task to create a new email account. For example:
- name: Create a new email account
community.general.mail:
user: john.doe
password: mysecretpassword
alias: [email protected]
state: present
- Create an email alias: You can use the
mail_alias
task to create a new email alias. For example:
- name: Create an email alias
community.general.mail:
alias: [email protected]
destination: [email protected]
state: present
- Forward email: You can use the
mail_forward
task to forward email from one address to another. For example:
- name: Forward email from [email protected] to [email protected]
community.general.mail:
source: [email protected]
destination: [email protected]
state: present
- Delete an email account: You can use the
mail_user
task with thestate: absent
parameter to delete an email account. For example:
- name: Delete an email account
community.general.mail:
user: john.doe
state: absent
- Delete an email alias: You can use the
mail_alias
task with thestate: absent
parameter to delete an email alias. For example:
- name: Delete an email alias
community.general.mail:
alias: [email protected]
state: absent
- Flush email aliases: You can use the
mail_flush
task to flush the email aliases. For example:
- name: Flush email aliases
community.general.mail:
state: flushed
These are just a few examples of what you can do with the `community.general.mail` module. You can find more information about the available tasks and options in the Ansible documentation.
Note that the community.general.mail
module is not included in the default Ansible installation, so you may need to install it using the ansible-galaxy
command:
ansible-galaxy install community.general