Ajout d'une section dovecot oauth

This commit is contained in:
Navas 2024-08-30 18:27:36 +02:00
parent f0239ca599
commit dbc3d72833
2 changed files with 39 additions and 12 deletions

View file

@ -1,5 +1,5 @@
- name: docker-compose-up - name: Docker-compose-up
shell: | ansible.builtin.shell: |
docker compose up -d docker compose up -d
args: args:
chdir: /opt/{{ docker_mailserver_service_id }}/ chdir: /opt/{{ docker_mailserver_service_id }}/

View file

@ -1,18 +1,18 @@
- name: docker directory - name: Docker directory
file: ansible.builtin.file:
path: /opt/{{ docker_mailserver_service_id }}/ path: /opt/{{ docker_mailserver_service_id }}/
state: directory state: directory
- name: config directory - name: Config directory
file: ansible.builtin.file:
path: /opt/{{ docker_mailserver_service_id }}/{{ item }} path: /opt/{{ docker_mailserver_service_id }}/{{ item }}
state: directory state: directory
with_items: with_items:
- config - config
- ssl - ssl
- name: prepare dovecot custom config - name: Prepare dovecot custom config
blockinfile: ansible.builtin.blockinfile:
dest: /opt/{{ docker_mailserver_service_id }}/11-mail-custom.conf dest: /opt/{{ docker_mailserver_service_id }}/11-mail-custom.conf
marker: "# {mark} ANSIBLE CONFIGURATION" marker: "# {mark} ANSIBLE CONFIGURATION"
create: true create: true
@ -66,8 +66,35 @@
#auth_verbose = yes #auth_verbose = yes
- name: prepare docker-compose.yml and config - name: Prepare dovecot custom config
template: when: docker_mailserver_configure_oauth is true
ansible.builtin.blockinfile:
dest: /opt/{{ docker_mailserver_service_id }}/11-mail-custom.conf
marker: "# {mark} OAUTH ANSIBLE CONFIGURATION"
insertafter: EOF
block: |
### section authentification OpenID
auth_mechanisms = $auth_mechanisms xoauth2 oauthbearer
passdb {
driver = oauth2
mechanisms = xoauth2 oauthbearer
args = /etc/dovecot/dovecot-oauth2.conf.ext
}
# provide SASL via unix socket to postfix
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0660
# Assuming the default Postfix user and group
user = postfix
group = postfix
}
}
- name: Prepare docker-compose.yml and config
ansible.builtin.template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
with_items: with_items:
@ -78,8 +105,8 @@
notify: docker-compose-up notify: docker-compose-up
- name: Prepare dovecot-oauth2.conf.ext.secrets - name: Prepare dovecot-oauth2.conf.ext.secrets
when: docker_mailserver_configure_oauth is true
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ docker_mailserver_dovecot_oauth2_configuration }}" content: "{{ docker_mailserver_dovecot_oauth2_configuration }}"
dest: "/opt/{{ docker_mailserver_service_id }}/dovecot-oauth2.conf.ext.secrets" dest: "/opt/{{ docker_mailserver_service_id }}/dovecot-oauth2.conf.ext.secrets"
notify: docker-compose-up notify: docker-compose-up
when: docker_mailserver_configure_oauth is true