Use Ansible to replace *.desktop files by custom versions ?

19 views
Skip to first unread message

Nicolas Kovacs

unread,
Feb 27, 2024, 9:59:39 AM2/27/24
to ansible...@googlegroups.com
Hi,

Up until recently I’ve been using a bone-headed setup.sh shell script to
setup my desktop clients based on Rocky Linux 8 and a heavily customized
KDE desktop:

* https://gitlab.com/kikinovak/rocky-8-desktop

I’ve been learning to use Ansible for some time now (with a few false
starts) and I’m currently translating this script into Ansible’s way of
doing things:

* https://gitlab.com/kikinovak/rocky-8-ansible

In the original setup.sh script I have a replace_menus() function that
loops through *.desktop files in /usr/share/applications and other
places and replaces some of these with a custom version, but only if
they exist in the first place.

I wonder how I could possibly translate this into Ansible code. Here’s
what should happen:

1. Loop through all custom desktop entries in the templates/ directory.

2. If the corresponding .desktop file exists in /usr/share/applications,
then replace it with the custom version from templates/.

3. If it doesn’t exist, then don’t install the template.

4. In other words: install the template only if the target already exists.

Any idea how I could possibly translate this into Ansible code ?

Cheers from the sunny South of France,

Niki

--
Microlinux - Solutions informatiques durables
7, place de l'église - 30730 Montpezat
Site : https://www.microlinux.fr
Blog : https://blog.microlinux.fr
Mail : in...@microlinux.fr
Tél. : 04 66 63 10 32
Mob. : 06 51 80 12 12
Reply all
Reply to author
Forward
0 new messages