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

@ -2,74 +2,58 @@
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
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
- curl state: latest
- exa name:
- exuberant-ctags - curl
- ffmpeg - exa
- gpg - exuberant-ctags
- htop - ffmpeg
- nmap - gpg
- psmisc - htop
- shellcheck - nmap
- sqlite - psmisc
- stow - shellcheck
- tree - sqlite
- vifm - stow
- wget - tree
- youtube-dl - vifm
- wget
- 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
- coreutils name:
- ctags - coreutils
- curl - ctags
- exa - curl
- exiftool - exa
- ffmpeg - exiftool
- findutils - ffmpeg
- gnu-sed - findutils
- gpg - gnu-sed
- grep - gpg
- gzip - grep
- htop - gzip
- imagemagick - htop
- jupyter - imagemagick
- make - jupyter
- nmap - make
- pstree - nmap
- reattach-to-user-namespace - pstree
- shellcheck - reattach-to-user-namespace
- sqlite - shellcheck
- stow - sqlite
- tree - stow
- vifm - tree
- wget - vifm
- youtube-dl - wget
- 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