Ansible – Getting Started

Generate a key on your local host

ssh-keygen -t rsa -b 4096 -C “youruser@myemail”

Add your public key into the remote host under the .ssh folder into authorized_keys

Create a hosts file


Run ansible to check

ansible -i (for inventory) hosts all -m ping – Check ping for all host in the all group.

Testing Postfix after installation with Clamav and Spamassasin


Test files

touch sample-virus-simple.txt

touch sample-spam-GTUBE-junk.txt

Normal Message test

swaks –to –server localhost

amavis[1486]: (01486-02) Passed CLEAN {RelayedInternal}, LOCAL []:50268

( – This is where you would like a test message to be delivered)

Testing VIRUS checking

swaks -t root@localhost –server localhost -d sample-virus-simple.txt

amavis[1488]: (01488-02) Blocked INFECTED (Eicar-Test-Signature) {DiscardedOutbound,Quarantined}, LOCAL []:50314


Install test files:

sudo apt-get install clamav-testfiles

Then test it:

sudo clamdscan /usr/share/clamav-testfiles/

Once tested you can remove them:

sudo apt-get remove clamav-testfiles

Testing SPAM checking

swaks -t root@localhost –server localhost -d sample-spam-GTUBE-junk.txt

amavis[1487]: (01487-02) Blocked SPAM {DiscardedInternal,Quarantined}, LOCAL []:50238

File Examples:


Subject: Test spam mail (GTUBE)
Message-ID: <>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <>
To: Recipient <>
Precedence: junk
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is the GTUBE, the
Test for

If your spam filter supports it, the GTUBE provides a test by which you
can verify that the filter is installed correctly and is detecting incoming
spam. You can send yourself a test mail containing the following string of
characters (in upper case and with no white spaces and line breaks):


You should send this test mail from an account outside of your network.


From: virus-tester
To: undisclosed-recipients:;
Subject: amavisd test – simple – virus scanner test pattern



On Debian you can use: pflogsumm

sudo apt-get install pflogsumm

sudo pflogsumm -d today /var/log/mail.log

Postfix log summaries for Oct 3

Grand Totals

16 received
16 delivered
0 forwarded
0 deferred
0 bounced
2 rejected (11%)
0 reject warnings
0 held
0 discarded (0%)

14189 bytes received
14189 bytes delivered
3 senders
2 sending hosts/domains
3 recipients
2 recipient hosts/domains