#!{{ ansible_python['executable'] }}

# {{ ansible_managed }}

from __future__ import print_function
from json import loads, dumps
from sys import exit
import os

output = ({
    'configured': True,
    'newaliases': False
})

newaliases_path = [
    '/usr/bin/newaliases',
    '/usr/sbin/newaliases'
]

for file_path in newaliases_path:
    if os.path.isfile(file_path) and os.access(file_path, os.X_OK):
        output.update({'newaliases': True})

print(dumps(output, sort_keys=True, indent=4))
