Closed paulp closed 9 years ago
Good point, we could do something like this !
I'll slightly modify that suggestion: space delimited, much better.
:+1:
After some struggling with the ansible syntax I have determined that one can already do this as follows:
vars:
- casks: [ alfred, asepsis, bartender, bettertouchtool, caffeine, filebot,
google-chrome, iterm2, keyboard-cleaner, lastpass-universal,
sublime-text-dev, textexpander ]
tasks:
- name: install homebrew casks
homebrew_cask: name={{ item }} state=present
with_items: casks
Another approach is to have a file casks.yml containing e.g.
- name: install homebrew casks
homebrew_cask: name={{ item }} state=present
with_items:
- adapter
- alfred
- appcleaner
- asepsis
- bartender
- bettertouchtool
- bonjour-browser
- caffeine
- cocktail
- dropbox
- fantastical
- filebot
- firefox
- font-source-code-pro
- gitx-rowanj
- google-chrome
- google-chrome-canary
- growlnotify
- hazel
- iterm2
- key-codes
- keyboard-cleaner
- lastpass-universal
- launchcontrol
- musicbrainz-picard
- skim
- sonos
- sublime-text-dev
- subtitles
- textexpander
- tinkertool
- tvshows
- vlc
- xquartz
And in all.yaml,
tasks:
- include: casks.yml
What I'd really like is to have a file with one cask to a line, plus any options it needs for building, with no yaml syntax confusing the matter. This might be possible but I haven't found it yet, ansible seems keen on everything being yaml.
I like you last suggestion a lot. Copying-it :-). Thanks for sharing
Or, we could make a conditional in the role either it can accept this syntax:
- role: cask_package
package_name: firefox
or this one:
- role: cask_package
package_names: [firefox, dropbox, chromium]
Since I don't think it's possible to have a space delimited or otherwise non-yaml list without resorting to slurping a file in via the shell, I'd say the package_names which takes a list is the sensible measure.
The example config has maybe 30 lines of information in 160 lines of yaml. I find this fairly obscene. Is there any hope for a more concise syntax?
As a strawman for illustrative purposes only, something like
would be a huge improvement.