diff --git a/playbooks/bootstrap/roles/postfix/defaults/main.yaml b/playbooks/bootstrap/roles/postfix/defaults/main.yaml new file mode 100644 index 0000000..7460bb7 --- /dev/null +++ b/playbooks/bootstrap/roles/postfix/defaults/main.yaml @@ -0,0 +1,26 @@ +# Copyright 2019 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +# tasks/main.yaml +postfix_task_manager: + - install + - service + +postfix_package_name: postfix + +postfix_service_postfix_daemon_reload: true +postfix_service_postfix_enabled: true +postfix_service_postfix_manage: true +postfix_service_postfix_name: postfix +postfix_service_postfix_state: started diff --git a/playbooks/bootstrap/roles/postfix/tasks/install.yaml b/playbooks/bootstrap/roles/postfix/tasks/install.yaml new file mode 100644 index 0000000..3f1cceb --- /dev/null +++ b/playbooks/bootstrap/roles/postfix/tasks/install.yaml @@ -0,0 +1,19 @@ +# Copyright 2010 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- name: Install postfix from package + become: true + package: + name: "{{ postfix_package_name }}" + state: present diff --git a/playbooks/bootstrap/roles/postfix/tasks/main.yaml b/playbooks/bootstrap/roles/postfix/tasks/main.yaml new file mode 100644 index 0000000..cc49ba5 --- /dev/null +++ b/playbooks/bootstrap/roles/postfix/tasks/main.yaml @@ -0,0 +1,18 @@ +# Copyright 2019 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- include: "{{ postfix_task }}.yaml" + with_items: "{{ postfix_task_manager }}" + loop_control: + loop_var: postfix_task diff --git a/playbooks/bootstrap/roles/postfix/tasks/service.yaml b/playbooks/bootstrap/roles/postfix/tasks/service.yaml new file mode 100644 index 0000000..b5698ac --- /dev/null +++ b/playbooks/bootstrap/roles/postfix/tasks/service.yaml @@ -0,0 +1,33 @@ +# Copyright 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- name: Enable postfix service + become: true + systemd: + daemon_reload: "{{ postfix_service_postfix_daemon_reload }}" + enabled: "{{ postfix_service_postfix_enabled }}" + name: "{{ postfix_service_postfix_name }}" + register: postfix_service_postfix + when: postfix_service_postfix_manage + +- name: Set postfix service state + become: true + systemd: + daemon_reload: "{{ postfix_service_postfix_daemon_reload }}" + name: "{{ postfix_service_postfix_name }}" + state: "{{ postfix_service_postfix_state }}" + register: postfix_service_postfix_state_info + when: + - postfix_service_postfix_manage + - postfix_service_postfix_state in ['reloaded', 'restarted', 'started', 'stopped'] diff --git a/playbooks/bootstrap/site.yaml b/playbooks/bootstrap/site.yaml index d509d59..4bf0d5e 100644 --- a/playbooks/bootstrap/site.yaml +++ b/playbooks/bootstrap/site.yaml @@ -36,6 +36,10 @@ include_role: name: swap + - name: Setup postfix role + include_role: + name: postfix + - name: Setup openstack.virtualenv role include_role: name: openstack.virtualenv