mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 13:49:52 +00:00
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:
@@ -57,6 +57,7 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
||||
- Emacs is disabled by default; temporary Emacs check: `ansible-playbook ansible/site.yml --limit <host> --tags emacs --check --diff -e emacs_enabled=true`
|
||||
- AI coding agents: `ansible-playbook ansible/site.yml --limit <host> --tags ai_agents --check --diff`
|
||||
- Mail bootstrap: `sh -n scripts/bootstrap_mail.sh` and `shellcheck scripts/bootstrap_mail.sh`
|
||||
- Thunderbird iCloud profile: `ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird --check --diff`
|
||||
- Server NPM Quadlet: `systemctl status prometheus-npm.service`; the Compose fallback is retired.
|
||||
- Explicit Prometheus legacy cleanup (destructive only without check mode):
|
||||
`ansible-playbook ansible/site.yml --limit prometheus --tags server_legacy_cleanup --check --diff -e server_legacy_cleanup=true`
|
||||
@@ -116,6 +117,7 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
||||
- `dotfiles/desktop/.config/niri/config.kdl` and `session-env` deployed via `desktop_niri_dotfiles` (Niri / Wayland)
|
||||
- Void Niri lives in `profile_desktop_niri`, gated on `'niri' in desktop_sessions_enabled`; it installs the `emptty` `niri.desktop` session, the `/usr/local/bin/start-niri` launcher, and the xdg-desktop-portal config, mirroring `profile_desktop_sway`.
|
||||
- Fedora GNOME (`desktop_gnome`) assumes GNOME comes from the Fedora Workstation base install; Ansible deploys shared desktop dotfiles and git/GPG config for `ikaros` and `nymph`, not GNOME settings.
|
||||
- `profile_desktop_gnome` also seeds a Thunderbird profile for `ikaros` and `nymph` with the iCloud IMAP/SMTP account, one CalDAV calendar and one CardDAV address book. Account defaults are rendered into a managed `user.js` because Thunderbird rewrites `prefs.js`; `profiles.ini` is only seeded when absent. The address comes from `vault_icloud_email` and the app-specific password is never stored.
|
||||
- Do not switch or restart the display manager during a playbook run from an active graphical session.
|
||||
- `nymph` is the Fedora/GNOME laptop target; keep GNOME settings unmanaged for now and add host-specific tuning only after real use.
|
||||
|
||||
|
||||
23
README.md
23
README.md
@@ -639,6 +639,29 @@ Run locally on each workstation (`ansible_connection: local`); use `--limit nymp
|
||||
on the laptop. With a cold RPM cache, check mode reports that dependency resolution
|
||||
is not validated; the real run downloads, verifies, and installs the package.
|
||||
|
||||
### Thunderbird iCloud profile on Fedora
|
||||
|
||||
`profile_desktop_gnome` seeds a Thunderbird profile for `ikaros` and `nymph` so the
|
||||
iCloud account is already declared: IMAP `imap.mail.me.com:993` over SSL/TLS, SMTP
|
||||
`smtp.mail.me.com:587` over STARTTLS, the identity and folder mapping, one CalDAV
|
||||
calendar (`caldav.icloud.com`) and one CardDAV address book (`contacts.icloud.com`).
|
||||
|
||||
The account defaults live in a managed `user.js`, not in `prefs.js`: Thunderbird
|
||||
rewrites `prefs.js` on exit, while `user.js` is re-applied at every start.
|
||||
`profiles.ini` is only seeded 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 password is deliberately not stored: iCloud mail
|
||||
requires an app-specific password, which Thunderbird requests on first use and
|
||||
keeps in its own credential store. Set `thunderbird_icloud_enabled: false` to stop
|
||||
managing the profile without deleting it.
|
||||
|
||||
```bash
|
||||
ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird --check --diff
|
||||
ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird -K
|
||||
```
|
||||
|
||||
## Main roles
|
||||
|
||||
| Role | What it does |
|
||||
|
||||
@@ -101,3 +101,23 @@ desktop_gnome_dotfiles:
|
||||
src: .config/autostart/Nextcloud.desktop
|
||||
dest: .config/autostart/Nextcloud.desktop
|
||||
mode: "0644"
|
||||
|
||||
# Thunderbird is provisioned from a seeded profile plus a managed user.js:
|
||||
# Thunderbird rewrites prefs.js on exit, so the declared account, calendar and
|
||||
# address book defaults are re-applied at every start from user.js instead.
|
||||
# The address comes from Vault; the app-specific password is never stored here
|
||||
# and is requested by Thunderbird on first use.
|
||||
thunderbird_icloud_enabled: true
|
||||
thunderbird_profile_name: "{{ username }}"
|
||||
thunderbird_profile_dir: "{{ username }}.default-release"
|
||||
thunderbird_full_name: "{{ vault_personal_full_name | default(username) }}"
|
||||
thunderbird_icloud_email: "{{ vault_icloud_email }}"
|
||||
thunderbird_icloud_account_name: iCloud
|
||||
thunderbird_icloud_imap_host: imap.mail.me.com
|
||||
thunderbird_icloud_imap_port: 993
|
||||
thunderbird_icloud_smtp_host: smtp.mail.me.com
|
||||
thunderbird_icloud_smtp_port: 587
|
||||
thunderbird_icloud_caldav_url: https://caldav.icloud.com/
|
||||
thunderbird_icloud_carddav_url: https://contacts.icloud.com/
|
||||
thunderbird_icloud_calendar_id: 4f2c1d6e-9b3a-4f7c-8e21-6d5a0c9b7e13
|
||||
thunderbird_icloud_addressbook_uid: 9e0b7c4a-2d51-4a8f-b6c3-1f7d5e2a8b46
|
||||
|
||||
@@ -279,3 +279,8 @@
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
when: workstation_firewall_backend | default('firewalld') == 'firewalld'
|
||||
|
||||
- name: Configure Thunderbird for iCloud
|
||||
tags: [dotfiles, dotfiles:desktop, gnome, thunderbird]
|
||||
ansible.builtin.import_tasks: thunderbird.yml
|
||||
when: thunderbird_icloud_enabled | default(false) | bool
|
||||
|
||||
52
ansible/roles/profile_desktop_gnome/tasks/thunderbird.yml
Normal file
52
ansible/roles/profile_desktop_gnome/tasks/thunderbird.yml
Normal 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
|
||||
@@ -0,0 +1,9 @@
|
||||
[Profile0]
|
||||
Name={{ thunderbird_profile_name }}
|
||||
IsRelative=1
|
||||
Path={{ thunderbird_profile_dir }}
|
||||
Default=1
|
||||
|
||||
[General]
|
||||
StartWithLastProfile=1
|
||||
Version=2
|
||||
@@ -0,0 +1,65 @@
|
||||
// Managed by Ansible from profile_desktop_gnome (tag: thunderbird).
|
||||
// Thunderbird rewrites prefs.js on exit, so the declared defaults live here
|
||||
// and are re-applied at every start. Do not edit this file by hand.
|
||||
//
|
||||
// The account password is intentionally absent: iCloud mail requires an
|
||||
// app-specific password, which Thunderbird prompts for and stores in its own
|
||||
// credential store on first use.
|
||||
|
||||
// Mail account
|
||||
user_pref("mail.accountmanager.accounts", "account1");
|
||||
user_pref("mail.accountmanager.defaultaccount", "account1");
|
||||
user_pref("mail.account.account1.server", "server1");
|
||||
user_pref("mail.account.account1.identities", "id1");
|
||||
|
||||
user_pref("mail.server.server1.type", "imap");
|
||||
user_pref("mail.server.server1.hostname", "{{ thunderbird_icloud_imap_host }}");
|
||||
user_pref("mail.server.server1.port", {{ thunderbird_icloud_imap_port }});
|
||||
user_pref("mail.server.server1.socketType", 3);
|
||||
user_pref("mail.server.server1.authMethod", 3);
|
||||
user_pref("mail.server.server1.userName", "{{ thunderbird_icloud_email }}");
|
||||
user_pref("mail.server.server1.name", "{{ thunderbird_icloud_account_name }}");
|
||||
user_pref("mail.server.server1.directory-rel", "[ProfD]ImapMail/{{ thunderbird_icloud_imap_host }}");
|
||||
user_pref("mail.server.server1.directory", "{{ user_home }}/.thunderbird/{{ thunderbird_profile_dir }}/ImapMail/{{ thunderbird_icloud_imap_host }}");
|
||||
user_pref("mail.server.server1.max_cached_connections", 5);
|
||||
user_pref("mail.server.server1.check_new_mail", true);
|
||||
user_pref("mail.server.server1.check_time", 10);
|
||||
user_pref("mail.server.server1.login_at_startup", true);
|
||||
user_pref("mail.server.server1.empty_trash", false);
|
||||
|
||||
user_pref("mail.identity.id1.fullName", "{{ thunderbird_full_name }}");
|
||||
user_pref("mail.identity.id1.useremail", "{{ thunderbird_icloud_email }}");
|
||||
user_pref("mail.identity.id1.valid", true);
|
||||
user_pref("mail.identity.id1.smtpServer", "smtp1");
|
||||
user_pref("mail.identity.id1.compose_html", true);
|
||||
user_pref("mail.identity.id1.fcc_folder", "mailbox://{{ thunderbird_icloud_email }}@{{ thunderbird_icloud_imap_host }}/Sent%20Messages");
|
||||
user_pref("mail.identity.id1.draft_folder", "mailbox://{{ thunderbird_icloud_email }}@{{ thunderbird_icloud_imap_host }}/Drafts");
|
||||
|
||||
user_pref("mail.smtpservers", "smtp1");
|
||||
user_pref("mail.smtpserver.smtp1.hostname", "{{ thunderbird_icloud_smtp_host }}");
|
||||
user_pref("mail.smtpserver.smtp1.port", {{ thunderbird_icloud_smtp_port }});
|
||||
user_pref("mail.smtpserver.smtp1.try_ssl", 2);
|
||||
user_pref("mail.smtpserver.smtp1.authMethod", 3);
|
||||
user_pref("mail.smtpserver.smtp1.username", "{{ thunderbird_icloud_email }}");
|
||||
user_pref("mail.smtpserver.smtp1.description", "{{ thunderbird_icloud_account_name }} SMTP");
|
||||
|
||||
// Calendar (CalDAV). Calendars are discovered from the registry branch.
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.type", "caldav");
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.name", "{{ thunderbird_icloud_account_name }}");
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.uri", "{{ thunderbird_icloud_caldav_url }}");
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.username", "{{ thunderbird_icloud_email }}");
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.refreshInterval", 30);
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.readOnly", false);
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.disabled", false);
|
||||
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.color", "#3a87ad");
|
||||
user_pref("calendar.list.sortOrder", "{{ thunderbird_icloud_calendar_id }}");
|
||||
|
||||
// Address book (CardDAV). dirType 102 is nsIAbManager.CARDDAV_DIRECTORY_TYPE.
|
||||
user_pref("ldap_2.servers.icloud.dirType", 102);
|
||||
user_pref("ldap_2.servers.icloud.uid", "{{ thunderbird_icloud_addressbook_uid }}");
|
||||
user_pref("ldap_2.servers.icloud.description", "{{ thunderbird_icloud_account_name }}");
|
||||
user_pref("ldap_2.servers.icloud.filename", "abook-icloud.sqlite");
|
||||
user_pref("ldap_2.servers.icloud.isOffline", false);
|
||||
user_pref("ldap_2.servers.icloud.position", 3);
|
||||
user_pref("ldap_2.servers.icloud.carddav.url", "{{ thunderbird_icloud_carddav_url }}");
|
||||
user_pref("ldap_2.servers.icloud.carddav.username", "{{ thunderbird_icloud_email }}");
|
||||
Reference in New Issue
Block a user