Provision the iCloud Thunderbird profile on GNOME desktops

Seed a Thunderbird profile on ikaros and nymph with the iCloud account
already declared: IMAP imap.mail.me.com:993 over SSL/TLS, SMTP
smtp.mail.me.com:587 over STARTTLS, identity and folder mapping, one
CalDAV calendar and one CardDAV address book.

Account defaults are rendered into a managed user.js because Thunderbird
rewrites prefs.js on exit, while user.js is re-applied at every start.
profiles.ini is seeded only when absent so a profile list Thunderbird
already owns is never replaced.

The address comes from vault_icloud_email and the display name from
vault_personal_full_name. The app-specific password is deliberately not
stored: Thunderbird requests it on first use and keeps it in its own
credential store.

Validated by rendering the templates and running Thunderbird 158 headless
against a sandbox profile: the account was accepted, Local Folders was
created by Thunderbird itself, the CalDAV calendar registered as default
and the CardDAV directory instantiated its abook-icloud.sqlite.
This commit is contained in:
2026-11-01 19:30:10 +01:00
parent 4e8665a7d4
commit 1e40a867e7
7 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
---
- name: Require the iCloud address for the managed Thunderbird profile
tags: [thunderbird]
ansible.builtin.assert:
that:
- vault_icloud_email is defined
- vault_icloud_email | length > 0
- vault_icloud_email != 'REPLACE_ME'
- vault_icloud_email is match('^[^@\s]+@[^@\s]+$')
fail_msg: >-
vault_icloud_email must hold the iCloud mail address before the
Thunderbird profile can be provisioned.
quiet: true
- name: Create the Thunderbird configuration directory
tags: [thunderbird]
ansible.builtin.file:
path: "{{ user_home }}/.thunderbird"
state: directory
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0700"
- name: Create the managed Thunderbird profile directory
tags: [thunderbird]
ansible.builtin.file:
path: "{{ user_home }}/.thunderbird/{{ thunderbird_profile_dir }}"
state: directory
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0700"
- name: Seed the Thunderbird profile registry when absent
tags: [thunderbird]
ansible.builtin.template:
src: thunderbird/profiles.ini.j2
dest: "{{ user_home }}/.thunderbird/profiles.ini"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0600"
# Never rewrite a profile list Thunderbird has already taken over.
force: false
- name: Render the managed Thunderbird account defaults
tags: [thunderbird]
ansible.builtin.template:
src: thunderbird/user.js.j2
dest: "{{ user_home }}/.thunderbird/{{ thunderbird_profile_dir }}/user.js"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0600"
no_log: true