home · contact · privacy
Fix wicd config file setting.
[config] / ansible / tasks / initial_purge.yml
1 ---
2
3 - name: collect officially required packages
4   shell: dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > /tmp/list_white_unsorted
5
6 - name: add "ifupdown" and "isc-dhcp-client" (to keep internet connection afterwards) and "ansible" (to keep its modules available for continuing the configuration) to required packages
7   shell: echo 'ifupdown' >> /tmp/list_white_unsorted && echo 'isc-dhcp-client' >> /tmp/list_white_unsorted && echo 'ansible' >> /tmp/list_white_unsorted && sort /tmp/list_white_unsorted > /tmp/list_white
8
9 - name: collect currently installed packages
10   shell: dpkg-query -Wf '${Package}\n' > /tmp/list_all_packages && sort /tmp/list_all_packages > /tmp/foo && mv /tmp/foo /tmp/list_all_packages
11
12 - name: create black list of packages to mark as automatically installed from the difference between the required packages and the packages currently installed
13   shell: comm -3 /tmp/list_all_packages /tmp/list_white > /tmp/list_black
14
15 - name: mark all packages from black list as automatically installed
16   shell: apt-mark auto $(cat /tmp/list_black)
17
18 - name: purge all packages automatically installed that are not depended on
19   shell: DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
20
21 - name: ensure flags directory exists
22   file: path=flags state=directory
23
24 - name: set initial_purge_happened flag, so that this whole process does not get repeated
25   file: path=flags/initial_purge_happened state=touch