Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
#-----------------------------------------------------------------------------#
# 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