|
171 | 171 | - dfe_has_gnome | default(false) |
172 | 172 |
|
173 | 173 | # ============================================================================ |
174 | | -# DISABLE UBUNTU PRO/ESM ADVERTISING (Ubuntu only) |
| 174 | +# DISABLE TELEMETRY AND ADVERTISING (Corporate deployment) |
175 | 175 | # ============================================================================ |
176 | | -# Removes promotional messages from apt output and MOTD |
| 176 | +# Removes promotional messages, crash reporting, and telemetry for privacy |
| 177 | +# and to prevent data leakage in corporate environments. |
177 | 178 |
|
178 | | -- name: Disable Ubuntu Pro advertising |
| 179 | +# ----------------------------------------------------------------------------- |
| 180 | +# UBUNTU: Disable Ubuntu Pro/ESM advertising and telemetry |
| 181 | +# ----------------------------------------------------------------------------- |
| 182 | +- name: Disable Ubuntu advertising and telemetry |
179 | 183 | block: |
| 184 | + # --- Ubuntu Pro/ESM Advertising --- |
180 | 185 | - name: Disable apt ESM hook (removes apt upgrade messages) |
181 | 186 | ansible.builtin.file: |
182 | 187 | path: /etc/apt/apt.conf.d/20apt-esm-hook.conf |
|
194 | 199 | changed_when: "'Successfully' in pro_apt_news.stdout" |
195 | 200 | failed_when: false |
196 | 201 |
|
| 202 | + # --- MOTD Advertising (Canonical news/ads) --- |
| 203 | + - name: Disable MOTD news fetching |
| 204 | + ansible.builtin.lineinfile: |
| 205 | + path: /etc/default/motd-news |
| 206 | + regexp: '^ENABLED=' |
| 207 | + line: 'ENABLED=0' |
| 208 | + create: true |
| 209 | + mode: '0644' |
| 210 | + |
| 211 | + # --- Apport (crash reporting to Canonical) --- |
| 212 | + - name: Disable Apport crash reporting |
| 213 | + ansible.builtin.lineinfile: |
| 214 | + path: /etc/default/apport |
| 215 | + regexp: '^enabled=' |
| 216 | + line: 'enabled=0' |
| 217 | + |
| 218 | + - name: Stop and disable Apport service |
| 219 | + ansible.builtin.systemd: |
| 220 | + name: apport |
| 221 | + state: stopped |
| 222 | + enabled: false |
| 223 | + failed_when: false |
| 224 | + |
| 225 | + # --- Whoopsie (error reporting daemon) --- |
| 226 | + - name: Stop and disable Whoopsie error reporting |
| 227 | + ansible.builtin.systemd: |
| 228 | + name: whoopsie |
| 229 | + state: stopped |
| 230 | + enabled: false |
| 231 | + failed_when: false |
| 232 | + |
| 233 | + # --- Ubuntu Report (first-run telemetry) --- |
| 234 | + - name: Opt out of Ubuntu Report telemetry |
| 235 | + ansible.builtin.command: |
| 236 | + cmd: ubuntu-report send no |
| 237 | + register: ubuntu_report |
| 238 | + changed_when: ubuntu_report.rc == 0 |
| 239 | + failed_when: false |
| 240 | + |
197 | 241 | when: ansible_distribution == 'Ubuntu' |
198 | 242 |
|
| 243 | +# ----------------------------------------------------------------------------- |
| 244 | +# FEDORA: Disable ABRT and telemetry |
| 245 | +# ----------------------------------------------------------------------------- |
| 246 | +- name: Disable Fedora telemetry |
| 247 | + block: |
| 248 | + # --- ABRT (crash reporting to Red Hat) --- |
| 249 | + - name: Disable ABRT crash reporting services |
| 250 | + ansible.builtin.systemd: |
| 251 | + name: "{{ item }}" |
| 252 | + state: stopped |
| 253 | + enabled: false |
| 254 | + loop: |
| 255 | + - abrt-journal-core |
| 256 | + - abrt-oops |
| 257 | + - abrt-xorg |
| 258 | + - abrt-vmcore |
| 259 | + - abrt-pstoreoops |
| 260 | + failed_when: false |
| 261 | + |
| 262 | + # --- Fedora Third Party Repos (optional, keep enabled for Chrome etc) --- |
| 263 | + # Not disabling fedora-third-party as it's useful for Chrome, Steam, etc. |
| 264 | + |
| 265 | + when: ansible_distribution == 'Fedora' |
| 266 | + |
| 267 | +# ----------------------------------------------------------------------------- |
| 268 | +# GNOME: Disable desktop telemetry (both distros) |
| 269 | +# ----------------------------------------------------------------------------- |
| 270 | +- name: Disable GNOME telemetry |
| 271 | + block: |
| 272 | + - name: Disable GNOME problem reporting |
| 273 | + community.general.dconf: |
| 274 | + key: "/org/gnome/desktop/privacy/report-technical-problems" |
| 275 | + value: "false" |
| 276 | + state: present |
| 277 | + become: false |
| 278 | + |
| 279 | + - name: Disable GNOME software usage stats |
| 280 | + community.general.dconf: |
| 281 | + key: "/org/gnome/desktop/privacy/send-software-usage-stats" |
| 282 | + value: "false" |
| 283 | + state: present |
| 284 | + become: false |
| 285 | + |
| 286 | + when: |
| 287 | + - ansible_distribution in ['Fedora', 'Ubuntu'] |
| 288 | + - dfe_has_gnome | default(false) |
| 289 | + |
199 | 290 | # ============================================================================ |
200 | 291 | # DFE ADMIN TOOLS |
201 | 292 | # ============================================================================ |
|
0 commit comments