Skip to content

Commit 55f2beb

Browse files
author
Derek
committed
refactor: Move telemetry disable to dfe_developer_core role
- Created dedicated telemetry.yml task file in core role - Removed duplicate telemetry code from utilities.yml - Added 'telemetry' tag for targeted runs - Keeps telemetry disable with core enterprise tools
1 parent 13b27c0 commit 55f2beb

3 files changed

Lines changed: 119 additions & 117 deletions

File tree

ansible/roles/dfe_developer/tasks/utilities.yml

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -170,123 +170,6 @@
170170
- ansible_distribution in ['Fedora', 'Ubuntu']
171171
- dfe_has_gnome | default(false)
172172

173-
# ============================================================================
174-
# DISABLE TELEMETRY AND ADVERTISING (Corporate deployment)
175-
# ============================================================================
176-
# Removes promotional messages, crash reporting, and telemetry for privacy
177-
# and to prevent data leakage in corporate environments.
178-
179-
# -----------------------------------------------------------------------------
180-
# UBUNTU: Disable Ubuntu Pro/ESM advertising and telemetry
181-
# -----------------------------------------------------------------------------
182-
- name: Disable Ubuntu advertising and telemetry
183-
block:
184-
# --- Ubuntu Pro/ESM Advertising ---
185-
- name: Disable apt ESM hook (removes apt upgrade messages)
186-
ansible.builtin.file:
187-
path: /etc/apt/apt.conf.d/20apt-esm-hook.conf
188-
state: absent
189-
190-
- name: Disable ESM MOTD message
191-
ansible.builtin.file:
192-
path: /etc/update-motd.d/91-contract-ua-esm-status
193-
state: absent
194-
195-
- name: Disable Ubuntu Pro apt news
196-
ansible.builtin.command:
197-
cmd: pro config set apt_news=false
198-
register: pro_apt_news
199-
changed_when: "'Successfully' in pro_apt_news.stdout"
200-
failed_when: false
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-
241-
when: ansible_distribution == 'Ubuntu'
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-
290173
# ============================================================================
291174
# DFE ADMIN TOOLS
292175
# ============================================================================

ansible/roles/dfe_developer_core/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,10 @@
6767
ansible.builtin.include_tasks:
6868
file: wallpaper.yml
6969
tags: ['wallpaper']
70+
71+
- name: Disable telemetry and advertising
72+
ansible.builtin.include_tasks:
73+
file: telemetry.yml
74+
apply:
75+
tags: ['telemetry']
76+
tags: ['telemetry']
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
# Disable telemetry and advertising for corporate deployments
3+
# Removes promotional messages, crash reporting, and telemetry for privacy
4+
# and to prevent data leakage in corporate environments.
5+
6+
# -----------------------------------------------------------------------------
7+
# UBUNTU: Disable Ubuntu Pro/ESM advertising and telemetry
8+
# -----------------------------------------------------------------------------
9+
- name: Disable Ubuntu advertising and telemetry
10+
block:
11+
# --- Ubuntu Pro/ESM Advertising ---
12+
- name: Disable apt ESM hook (removes apt upgrade messages)
13+
ansible.builtin.file:
14+
path: /etc/apt/apt.conf.d/20apt-esm-hook.conf
15+
state: absent
16+
17+
- name: Disable ESM MOTD message
18+
ansible.builtin.file:
19+
path: /etc/update-motd.d/91-contract-ua-esm-status
20+
state: absent
21+
22+
- name: Disable Ubuntu Pro apt news
23+
ansible.builtin.command:
24+
cmd: pro config set apt_news=false
25+
register: pro_apt_news
26+
changed_when: "'Successfully' in pro_apt_news.stdout"
27+
failed_when: false
28+
29+
# --- MOTD Advertising (Canonical news/ads) ---
30+
- name: Disable MOTD news fetching
31+
ansible.builtin.lineinfile:
32+
path: /etc/default/motd-news
33+
regexp: '^ENABLED='
34+
line: 'ENABLED=0'
35+
create: true
36+
mode: '0644'
37+
38+
# --- Apport (crash reporting to Canonical) ---
39+
- name: Disable Apport crash reporting
40+
ansible.builtin.lineinfile:
41+
path: /etc/default/apport
42+
regexp: '^enabled='
43+
line: 'enabled=0'
44+
45+
- name: Stop and disable Apport service
46+
ansible.builtin.systemd:
47+
name: apport
48+
state: stopped
49+
enabled: false
50+
failed_when: false
51+
52+
# --- Whoopsie (error reporting daemon) ---
53+
- name: Stop and disable Whoopsie error reporting
54+
ansible.builtin.systemd:
55+
name: whoopsie
56+
state: stopped
57+
enabled: false
58+
failed_when: false
59+
60+
# --- Ubuntu Report (first-run telemetry) ---
61+
- name: Opt out of Ubuntu Report telemetry
62+
ansible.builtin.command:
63+
cmd: ubuntu-report send no
64+
register: ubuntu_report
65+
changed_when: ubuntu_report.rc == 0
66+
failed_when: false
67+
68+
when: ansible_distribution == 'Ubuntu'
69+
70+
# -----------------------------------------------------------------------------
71+
# FEDORA: Disable ABRT and telemetry
72+
# -----------------------------------------------------------------------------
73+
- name: Disable Fedora telemetry
74+
block:
75+
# --- ABRT (crash reporting to Red Hat) ---
76+
- name: Disable ABRT crash reporting services
77+
ansible.builtin.systemd:
78+
name: "{{ item }}"
79+
state: stopped
80+
enabled: false
81+
loop:
82+
- abrt-journal-core
83+
- abrt-oops
84+
- abrt-xorg
85+
- abrt-vmcore
86+
- abrt-pstoreoops
87+
failed_when: false
88+
89+
when: ansible_distribution == 'Fedora'
90+
91+
# -----------------------------------------------------------------------------
92+
# GNOME: Disable desktop telemetry (both distros)
93+
# -----------------------------------------------------------------------------
94+
- name: Disable GNOME telemetry
95+
block:
96+
- name: Disable GNOME problem reporting
97+
community.general.dconf:
98+
key: "/org/gnome/desktop/privacy/report-technical-problems"
99+
value: "false"
100+
state: present
101+
become: false
102+
103+
- name: Disable GNOME software usage stats
104+
community.general.dconf:
105+
key: "/org/gnome/desktop/privacy/send-software-usage-stats"
106+
value: "false"
107+
state: present
108+
become: false
109+
110+
when:
111+
- ansible_distribution in ['Fedora', 'Ubuntu']
112+
- dfe_has_gnome | default(false)

0 commit comments

Comments
 (0)