From d07393cbd408efd167694de3b4b80df6731bd20c Mon Sep 17 00:00:00 2001 From: rubenb Date: Fri, 24 May 2024 13:37:16 +0200 Subject: [PATCH] test mail role --- linux-config-send-mail.yaml | 12 ++++++++++++ roles/config-send-mail/tasks/main.yaml | 15 +++++++++++++++ roles/config-send-mail/vars/main.yaml | 10 ++++++++++ 3 files changed, 37 insertions(+) create mode 100644 linux-config-send-mail.yaml create mode 100644 roles/config-send-mail/tasks/main.yaml create mode 100644 roles/config-send-mail/vars/main.yaml diff --git a/linux-config-send-mail.yaml b/linux-config-send-mail.yaml new file mode 100644 index 0000000..c95a115 --- /dev/null +++ b/linux-config-send-mail.yaml @@ -0,0 +1,12 @@ +--- + +- hosts: localhost + become: yes + become_method: sudo + gather_facts: no + + tasks: + + - name: "[CONFIG SEND MAIL] Send Mail" + import_role: + name: config-send-mail \ No newline at end of file diff --git a/roles/config-send-mail/tasks/main.yaml b/roles/config-send-mail/tasks/main.yaml new file mode 100644 index 0000000..cef3c10 --- /dev/null +++ b/roles/config-send-mail/tasks/main.yaml @@ -0,0 +1,15 @@ +--- +# roles/config-send-mail/tasks/main.yaml + +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +- name: Sending an e-mail using Verdnatura SMTP servers + community.general.mail: + host: smtp.verdnatura.es + port: 465 + username: awx@verdnatura.es + password: "{{ bindsecretawx_password }}" + to: sysadmin@verdnatura.es + subject: Ansible-test + body: System {{ ansible_hostname }} has been send successfully mail. + delegate_to: localhost +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/roles/config-send-mail/vars/main.yaml b/roles/config-send-mail/vars/main.yaml new file mode 100644 index 0000000..ae7603d --- /dev/null +++ b/roles/config-send-mail/vars/main.yaml @@ -0,0 +1,10 @@ +--- +# roles/config-send-mail/vars/main.yaml + +bindsecretawx_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 62393936623766653737356136353765336265636136616330306537393638646663326663346138 + 3631616362363163393036613564623864383365633634660a366563363836363061623566393361 + 37633364633631333130346332613235303762316435313535613664323830656363353237373561 + 3866653365636431630a303262666662376662623862663461633361333037643863353135343836 + 61383730366664353730616331666139376234313562383163613736353231666533