Browse Source

Add postfix to bootstrap playbook

It is helpful to enable email services by default, so we can get
notified of issues.

Change-Id: I326c4cdc1cc326904e12338a3ed96b2c59a4cc06
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
changes/08/649208/1
Paul Belanger 3 years ago
parent
commit
c51aed035e
  1. 26
      playbooks/bootstrap/roles/postfix/defaults/main.yaml
  2. 19
      playbooks/bootstrap/roles/postfix/tasks/install.yaml
  3. 18
      playbooks/bootstrap/roles/postfix/tasks/main.yaml
  4. 33
      playbooks/bootstrap/roles/postfix/tasks/service.yaml
  5. 4
      playbooks/bootstrap/site.yaml

26
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

19
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

18
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

33
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']

4
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

Loading…
Cancel
Save