Import the old role.
This commit is contained in:
parent
04cdaf7ce0
commit
96dd527665
42
README.md
42
README.md
|
@ -1,31 +1,37 @@
|
|||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
A role that installs the Dovecot imap server, <https://dovecot.org>
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
Some variables below. To really configure the service an additional role that changes the various configuration files must be created by the user.
|
||||
|
||||
``` yaml
|
||||
dovecot_service_enabled: True
|
||||
dovecot_rh_pkgs:
|
||||
- dovecot
|
||||
- dovecot-pigeonhole
|
||||
|
||||
dovecot_firewalld_services:
|
||||
- { service: 'pop3', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { service: 'pop3s', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { service: 'imap', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { service: 'imaps', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
|
||||
# 24 is LMTP
|
||||
# 4190 is ManageSieve
|
||||
dovecot_firewalld_ports:
|
||||
- { port: 24, protocol: 'tcp', state: 'disabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { port: 4190, protocol: 'tcp', state: 'disabled', zone: '{{ firewalld_default_zone }}' }
|
||||
|
||||
```
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
None
|
||||
|
||||
License
|
||||
-------
|
||||
|
@ -35,4 +41,4 @@ EUPL-1.2
|
|||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
Andrea Dell'Amico, <andrea.dellamico@isti.cnr.it>
|
||||
|
|
|
@ -1,2 +1,19 @@
|
|||
---
|
||||
# defaults file for ansible-role-template
|
||||
dovecot_service_enabled: True
|
||||
dovecot_rh_pkgs:
|
||||
- dovecot
|
||||
- dovecot-pigeonhole
|
||||
|
||||
dovecot_firewalld_services:
|
||||
- { service: 'pop3', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { service: 'pop3s', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { service: 'imap', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { service: 'imaps', state: 'enabled', zone: '{{ firewalld_default_zone }}' }
|
||||
|
||||
# 24 is LMTP
|
||||
# 4190 is ManageSieve
|
||||
dovecot_firewalld_ports:
|
||||
- { port: 24, protocol: 'tcp', state: 'disabled', zone: '{{ firewalld_default_zone }}' }
|
||||
- { port: 4190, protocol: 'tcp', state: 'disabled', zone: '{{ firewalld_default_zone }}' }
|
||||
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
# handlers file for ansible-role-template
|
|
@ -1,61 +1,25 @@
|
|||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
author: Andrea Dell'Amico
|
||||
description: Systems Architect
|
||||
company: ISTI-CNR
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: EUPL-1.2
|
||||
license: EUPL 1.2+
|
||||
|
||||
min_ansible_version: 2.8
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
galaxy_tags:
|
||||
- dovecot
|
||||
- imap
|
||||
- pop3
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
- name: Manage the firewalld rules
|
||||
block:
|
||||
- name: Manage the dovecot related services
|
||||
firewalld: service={{ item.service }} zone={{ item.zone }} permanent={{ item.permanent | default(True) }} state={{ item.state }} immediate=True
|
||||
with_items: '{{ dovecot_firewalld_services }}'
|
||||
|
||||
- name: Manage the dovecot related tcp/udp ports
|
||||
firewalld: port={{ item.port }}/{{ item.protocol }} zone={{ item.zone }} permanent={{ item.permanent | default(True) }} state={{ item.state }} immediate=True
|
||||
with_items: '{{ dovecot_firewalld_ports }}'
|
||||
|
||||
tags: [ 'dovecot', 'firewall', 'firewalld', 'iptables', 'iptables_rules' ]
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Manage the letsencrypt handler
|
||||
block:
|
||||
- name: Create the letsencrypt hooks directory if it is not present
|
||||
file: dest={{ letsencrypt_acme_services_scripts_dir }} state=directory owner=root group=root mode=0755
|
||||
|
||||
- name: Install the dovecot letsencrypt hook
|
||||
template: src=dovecot_letsencrypt_hook.sh.j2 dest={{ letsencrypt_acme_services_scripts_dir }}/dovecot owner=root group=root mode=0750
|
||||
|
||||
tags: [ 'dovecot', 'imap', 'letsencrypt' ]
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: Install the dovecot packages and start the service
|
||||
block:
|
||||
- name: Install the dovecot packages
|
||||
yum: pkg={{ dovecot_rh_pkgs }}
|
||||
|
||||
- name: Ensure that the service is started and enabled
|
||||
service: name=dovecot state=started enabled=yes
|
||||
when: dovecot_service_enabled | bool
|
||||
|
||||
- name: Stop and disable the dovecot service
|
||||
service: name=dovecot state=stopped enabled=no
|
||||
when: not dovecot_service_enabled | bool
|
||||
|
||||
tags: [ 'dovecot', 'imap' ]
|
|
@ -1,2 +1,8 @@
|
|||
---
|
||||
# tasks file for ansible-role-template
|
||||
- import_tasks: dovecot_rh.yml
|
||||
when: ansible_distribution_file_variety == "RedHat"
|
||||
- import_tasks: dovecot_firewalld.yml
|
||||
when: firewalld_enabled is defined and firewalld_enabled | bool
|
||||
- import_tasks: dovecot_letsencrypt.yml
|
||||
when: letsencrypt_acme_install is defined and letsencrypt_acme_install | bool
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
/bin/systemctl reload dovecot > {{ letsencrypt_acme_sh_log_dir }}/dovecot.log 2>&1
|
||||
|
||||
exit $?
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
# vars file for ansible-role-template
|
Loading…
Reference in New Issue