Bonjour
I’m little bit lost…
I want to use module community.general.osx_defaults
with list of apps and specific template for each apps. Simple, no?
- name: "MacOS | Dock | Add Apps shortcuts"
community.general.osx_defaults:
domain: com.apple.dock
key: persistent-apps
type: array
value: "{{ macos_configuration_apps_dock_list }}"
macos_configuration_apps_dock_list:
- "/System/Applications/Launchpad.app"
- "/Applications/Firefox.app"
[...]
But, the result, it emptys my dock
The secret is, for each icon, I need to have this type of value:
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>/Applications/Firefox.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
</dict>
I would like to do this, but for each item I don’t want to put all template above.
For bad example:
- name: "MacOS | Dock | Add Apps shortcuts"
community.general.osx_defaults:
domain: com.apple.dock
key: persistent-apps
type: array
value:
- <dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Firefox.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>
- <dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/System/Applications/Messages.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>
[...]
I would like to concatenate the template:
<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Firefox.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>
And list:
macos_configuration_apps_dock_list:
- "/System/Applications/Launchpad.app"
- "/Applications/Firefox.app"
[...]
And! I the module community.general.osx_defaults
declare list as a variable
- name: "MacOS | Dock | Add Apps shortcuts"
community.general.osx_defaults:
domain: com.apple.dock
key: persistent-apps
type: array
value: "{{ macos_configuration_apps_dock_list_template }}"
I tried many solutions, nested loops, templating jinja with {% for … %} but I don’t find solution…
If you have an advice. Thanks!