Hi,

I am pretty new to ansible,  i  am trying to get ansible to send me an 
email from my defined hosts  (as in the inventory file

To make the playbook work i have had to hardcode the FROM field within the 
email module of ansible.

I have hardcoded the playbook file  such that the FROM field is the control 
server .

This works.. however the FROM  field gives the wrong impression that the 
email is being sent from the control server , ie [email protected] but 
in other words its coming from each individual server .ie 
[email protected]....... etc

I have 6 servers under ansible control for my lab purposes ie server 1  to 
server6



---
- hosts: random-servers
  tasks:
    - mail: >
        to="[email protected]"
        from="[email protected]"
        body="Just testing ansible "
        subject="Welcome Sir This is just a test  "
        attach="/etc/hosts"



What i want to achieve is to set the  enveriablevariable code such that it 
refelects the right server from which the email is being sent from

I tried $HOSTNAME  i tried  `hostname`

But its simply a case of not knowing how the set the environment variables 
right or using the wrong syntax 

eseesntially the string  from="[email protected]"  need  to be 
dynamically changed via environment settings but i am not sure how
I have tried various syntax combinations and tried to set vars.. but it 
wouldnt work any help would be appreciated.

I tried from="[root@$HOSTNAME]"   and "[root@`hostname`]"    and all sorts 
of other syntax  combinations but no joy.

I tried to use the vars:  and environment options . which i am not familiar 
with .but it always failed each time.

Maybe there might be an easy answer from you ansible gurus.I love 
ansible..ive picked up so much in a very short time


 
i am running ansible 1.9.3 on Centos 7  

Help please any help would be greatly appreciated

Regards
D

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e98b24c3-cf97-4893-82ae-e3c1c5d64fde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to