Skip to content

Instantly share code, notes, and snippets.

@akvadrako
Created February 28, 2013 10:04
Show Gist options
  • Save akvadrako/5055631 to your computer and use it in GitHub Desktop.
Save akvadrako/5055631 to your computer and use it in GitHub Desktop.
send a welcome message from ansible
import yaml
class FilterModule(object):
def filters(self):
return {
'nice_yaml': lambda *a, **kw: yaml.safe_dump(*a, indent=4, default_flow_style=False, **kw),
}
---
- hosts: ${hosts}
tasks:
- mail: to=...
args:
from: root@$ansible_fqdn
body: $TEMPLATE(welcome.j2)
subject: welcome to $ansible_fqdn
Hi, I'm your new server!
My name is {{ ansible_fqdn }}.
RSA Host Key
------------
{{ ansible_ssh_host_key_rsa_public|nice_yaml }}
IPv4
----
{{ ansible_default_ipv4|nice_yaml }}
IPv6
----
{{ ansible_default_ipv6|nice_yaml }}
Hardware
------
{{ ansible_processor|nice_yaml }}
{{ ansible_devices|nice_yaml }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment