ansible: pass list to package managers instead of looping

Passing the list and letting the package manager deal with it as a whole
is much faster than looping, which is equivalent to invoking the package
manager multiple times, each time with a single package.
This commit is contained in:
Fernando Schauenburg 2020-12-17 19:15:27 +01:00
parent 38fb93fd16
commit ce68613438

View file

@ -3,8 +3,10 @@
become: yes become: yes
block: block:
- name: Install apt packages - name: Install apt packages
apt: name={{ item }} state=latest update_cache=yes apt:
loop: update_cache: yes
state: latest
name:
- curl - curl
- exa - exa
- exuberant-ctags - exuberant-ctags
@ -22,14 +24,13 @@
- youtube-dl - youtube-dl
- name: Set up macOS machine - name: Set up macOS machine
when: ansible_os_family == "Darwin" when: ansible_os_family == "Darwin"
block: block:
- name: Install homebrew packages - name: Install homebrew packages
homebrew: name={{ item }} state=latest homebrew:
loop: state: latest
name:
- coreutils - coreutils
- ctags - ctags
- curl - curl
@ -56,20 +57,3 @@
- wget - wget
- youtube-dl - youtube-dl
# - name: Tap into homebrew/cask-fonts
# homebrew_tap: tap=homebrew/cask-fonts state=present
# - name: Install Mac apps with homebrew cask
# homebrew_cask: name={{item}} state=present
# loop:
# - 1password
# - cyberduck
# - dropbox
# - firefox
# - font-source-code-pro
# - google-chrome
# - iterm2
# - transmission
# - vagrant
# - virtualbox