Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
smtp_relay.yml 3.37 KiB
Newer Older
---
#-----------------------------------------------------------------------------#
# ansible-yunohost allows to deploy Yunohost using Ansible                    #
# Copyright 2021-2021 Lydra https://www.lydra.fr/                             #
#                                                                             #
# this program is free software: you can redistribute it and/or modify        #
# it under the terms of the GNU General Public License as published by        #
# the Free Software Foundation, either version 3 of the License, or           #
# (at your option) any later version.                                         #
#                                                                             #
# this program is distributed in the hope that it will be useful,             #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with this program. If not, see <http://www.gnu.org/licenses/>.        #
#                                                                             #
#-----------------------------------------------------------------------------#

# - name: Get current SMTP relay host
#   ansible.builtin.command: "{{ ynh_smtp_get_cli }}.host"
#   register: ynh_old_smtp_relay_host
#   changed_when: False 

# - name: Set new SMTP relay host
#   ansible.builtin.command: "{{ ynh_smtp_set_cli }}.host -v {{ ynh_new_smtp_relay.host }}"
#   when: ynh_old_smtp_relay_host.stdout != ynh_new_smtp_relay.host

# - name: Get current SMTP relay port
#   ansible.builtin.command: "{{ ynh_smtp_get_cli }}.port"
#   register: ynh_old_smtp_port
#   changed_when: False 

# - name: Set new SMTP relay port
#   ansible.builtin.command: "{{ ynh_smtp_set_cli }}.host -v {{ ynh_new_smtp_relay.port }}"
#   when: ynh_old_smtp_port.stdout != ynh_new_smtp_relay.port

# - name: Get current SMTP relay username
#   ansible.builtin.command: "{{ ynh_smtp_get_cli }}.user"
#   register: ynh_old_smtp_user
#   changed_when: False 

# - name: Set new SMTP relay username
#   ansible.builtin.command: "{{ ynh_smtp_set_cli }}.user -v {{ ynh_new_smtp_relay.user }}"
#   when: ynh_old_smtp_user.stdout != ynh_new_smtp_relay.user

# - name: Get current SMTP relay password
#   ansible.builtin.command: "{{ ynh_smtp_get_cli }}.password"
#   register: ynh_old_smtp_password
#   changed_when: False 

# - name: Set new SMTP relay password
#   ansible.builtin.command: "{{ ynh_smtp_set_cli }}.host -v {{ ynh_new_smtp_relay.password }}"
#   when: ynh_old_smtp_password.stdout != ynh_new_smtp_relay.password

# - name: Set new SMTP relay port
#   ansible.builtin.command: "{{ ynh_smtp_set_cli }}.host -v {{ ynh_smtp_relay.host }}"
#   when: ynh_smtp_host_config.stdout != ynh_smtp_relay.host

- name: Get current SMTP settings
  ansible.builtin.command:
    "{{ ynh_smtp_get_cli }}.{{ item }}"
  register: _ynh_smtp_current_values
  with_items: "{{ ynh_new_smtp_relay }}"
  changed_when: False

- name: Set new SMTP settings
  ansible.builtin.command:
    "{{ ynh_smtp_set_cli }}.{{ item.key }} -v {{ item.value }}"
  with_items: "{{ ynh_new_smtp_relay | dict2items }}"
  changed_when: False