How to send mail using Ansible-Playbook

0 votes

Hi Guys,

I have configured Ansible in the Linux system. I want to create one playbook that sends mail to the user. Can anyone help me with this?

Aug 11, 2020 in Ansible by akhtar
• 38,210 points
2,170 views

1 answer to this question.

0 votes

Hi@akhtar,

You can find one module in Ansible named mail. This module has the capability to send mail to the user in Ansible. I have attached one playbook below for your reference.

- hosts: localhost
  tasks:
  - name: Sending an e-mail using Gmail SMTP servers
    mail:
      host: smtp.gmail.com
      port: 587
      username: xyz.na@gmail.com
      password: mypass
      to: abc.na@gmail.com
      subject: Ansible-report
      body: System {{ ansible_hostname }} has been successfully provisioned.

answered Aug 11, 2020 by MD
• 95,300 points

Related Questions In Ansible

0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,680 points
377 views
0 votes
1 answer
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,300 points
4,483 views
0 votes
1 answer

How to configure yum using Ansible Playbook?

Hi@akhtar, You need to use the yum_repository module ...READ MORE

answered Aug 4, 2020 in Ansible by MD
• 95,300 points
448 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,250 views
+2 votes
1 answer
+1 vote
1 answer

How to deploy war file into the Websphere using ansible playbook

Hi@M, You can use the below-given example. - name: ...READ MORE

answered Jun 29, 2020 in Ansible by MD
• 95,300 points
847 views
0 votes
1 answer

How to configure httpd web server using Ansible Playbook?

Hi@akhtar, You need to write one program file ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,300 points
571 views