Changing gsettings for another user from an ansible script (started by vagrant)
I've also struggled with setting the launcher favorites via ansible.
For me the solution was to use the ansible dconf
module instead of gsettings
:
- name: set icons/applications
dconf:
key: /com/canonical/unity/launcher/favorites
value: "{{ launcher_favorites }}"
state: present
I guess it also works with other users via become_user
(but I haven't tested it).
I recommend you place a .desktop
file into each user's ~/.config/autostart
folder that will call launcher setup script. Alternatively, place .desktop
file into /etc/xdg/autostart
so that script runs for every user, but then you'll need to grab username and find user launcher config in some form of database. Id personally use Python script that reads json file with username: launcher list valies, because it's simple.