diff --git a/lemp-rhel7/roles/ansible-role-postfix/.travis.yml b/lemp-rhel7/roles/ansible-role-postfix/.travis.yml new file mode 100644 index 0000000..df7b654 --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/.travis.yml @@ -0,0 +1,36 @@ +--- +sudo: required +language: python +python: "2.7" + +env: + - SITE=test.yml + +before_install: + - sudo apt-get update -qq + +install: + # Install Ansible. + - pip install ansible + + # Add ansible.cfg to pick up roles path. + - "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" + +script: + # Check the role/playbook's syntax. + - "ansible-playbook -i tests/inventory tests/$SITE --syntax-check" + + # Run the role/playbook with ansible-playbook. + - "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo" + + # Run the role/playbook again, checking to make sure it's idempotent. + - > + ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo + | grep -q 'changed=0.*failed=0' + && (echo 'Idempotence test: pass' && exit 0) + || (echo 'Idempotence test: fail' && exit 1) + + # TODO - Add test to check if postfix is working correctly. + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/lemp-rhel7/roles/ansible-role-postfix/README.md b/lemp-rhel7/roles/ansible-role-postfix/README.md new file mode 100644 index 0000000..6bb46a1 --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/README.md @@ -0,0 +1,31 @@ +# Ansible Role: Postfix + +[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-postfix.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-postfix) + +Installs postfix on RedHat/CentOS or Debian/Ubuntu. + +## Requirements + +If you're using this as an SMTP relay server, you will need to do that on your own, and open TCP port 25 in your server firewall. + +## Role Variables + +None. + +## Dependencies + +None. + +## Example Playbook + + - hosts: all + roles: + - { role: geerlingguy.postfix } + +## License + +MIT / BSD + +## Author Information + +This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/). diff --git a/lemp-rhel7/roles/ansible-role-postfix/defaults/main.yml b/lemp-rhel7/roles/ansible-role-postfix/defaults/main.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/lemp-rhel7/roles/ansible-role-postfix/meta/main.yml b/lemp-rhel7/roles/ansible-role-postfix/meta/main.yml new file mode 100644 index 0000000..1f034f1 --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/meta/main.yml @@ -0,0 +1,23 @@ +--- +dependencies: [] + +galaxy_info: + author: geerlingguy + description: Postfix for RedHat/CentOS or Debian/Ubuntu. + company: "Midwestern Mac, LLC" + license: "license (BSD, MIT)" + min_ansible_version: 1.8 + platforms: + - name: EL + versions: + - all + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - all + galaxy_tags: + - networking + - system + - mail diff --git a/lemp-rhel7/roles/ansible-role-postfix/tasks/main.yml b/lemp-rhel7/roles/ansible-role-postfix/tasks/main.yml new file mode 100644 index 0000000..6d0ca1a --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/tasks/main.yml @@ -0,0 +1,11 @@ +--- +- name: Ensure postfix is installed (RedHat). + yum: name=postfix state=installed + when: ansible_os_family == 'RedHat' + +- name: Ensure postfix is installed (Debian). + apt: name=postfix state=installed + when: ansible_os_family == 'Debian' + +- name: Ensure postfix is started and enabled at boot. + service: name=postfix state=started enabled=yes diff --git a/lemp-rhel7/roles/ansible-role-postfix/tests/inventory b/lemp-rhel7/roles/ansible-role-postfix/tests/inventory new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/tests/inventory @@ -0,0 +1 @@ +localhost diff --git a/lemp-rhel7/roles/ansible-role-postfix/tests/test.yml b/lemp-rhel7/roles/ansible-role-postfix/tests/test.yml new file mode 100644 index 0000000..f404e40 --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-postfix/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ansible-role-postfix