DigitalKrampus,
@DigitalKrampus@geekdom.social avatar

Just over here converting my Raspberry Pi bringup script to an ansible playbook. I am verifying it works with Vagrant+VirtualBox VMs before I try it on any hardware.

I learned all of this from Jeff Geerling's amazing book, Ansible for DevOps, ISBN 978-0986393426 if you want to check it out.

Jeff is on Mastadon @geerlingguy



dhoppe,
@dhoppe@chaos.social avatar

@DigitalKrampus @geerlingguy You should take another look at the documentation.

In your example, the command „apt“ is executed 8 times. It would be more effective to pass a list to the parameter „name:“ so that the command is only executed once.

geerlingguy,
@geerlingguy@mastodon.social avatar

@dhoppe yeah, one of the few places a loop is less efficient (though the apt module used to do a bit of lookahead and optimize that loop for you.

Still useful in weird cases where you need to set other package parameters per-package (but that's rare).

dhoppe,
@dhoppe@chaos.social avatar

@geerlingguy Looks like the apt module does not use this kind of magic anymore.
https://github.com/ansible/ansible/issues/82216#issuecomment-1810725082

geerlingguy,
@geerlingguy@mastodon.social avatar

@dhoppe yeah, it was a while back that the change was made.

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