me, avatar

I really wish module devs would make up their minds about how to pass stuff to it. So like the packages module? Pass it a list of packages, super easy

  • foo
  • bar
  • baz
    state: present

But say you want to create a bunch of directories? Well, sucks for you - the file module doesn't work that way:
path: "{{item}}"
owner: larted
group: luser
mode: "0755"
state: directory

  • "/haha"
  • "/fuck"
  • "/consistency"

And these are both BUILTIN modules. Seriously folks, make up your fucking minds. Shit like this makes being a pointlessly difficult.

mskoett, avatar

@me those two are doing things very differently.

Ansible.builtin.packages installs all the packages in one invocation. I.e. it's the equivalent of apt-get install foo bar baz.

Your example with ansible.builtin.file is using a loop construct iterating over a list of directories to create them one by one. The with_items is generic feature of Ansible and not something the file module is implementing. You could do the same when installing packages.

ascherbaum, avatar

@mskoett @me Except when you do that with installing packages, it complains. Had to rewrite a couple of tasks because of that.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Ansible
  • rosin
  • magazineikmin
  • GTA5RPClips
  • khanakhh
  • InstantRegret
  • Youngstown
  • mdbf
  • slotface
  • thenastyranch
  • everett
  • osvaldo12
  • kavyap
  • cubers
  • DreamBathrooms
  • megavids
  • Durango
  • modclub
  • ngwrru68w68
  • vwfavf
  • ethstaker
  • tester
  • cisconetworking
  • tacticalgear
  • Leos
  • provamag3
  • normalnudes
  • anitta
  • JUstTest
  • All magazines