mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-25 05:10:19 +00:00
Issue #36: Add option to install npm/composer/pip/gem packages
This commit is contained in:
parent
ddb070f2d4
commit
c211d1fdf7
3 changed files with 42 additions and 0 deletions
|
@ -75,5 +75,13 @@ mas_password: ""
|
|||
|
||||
osx_script: "~/.osx --no-restart"
|
||||
|
||||
# Install packages from other package managers.
|
||||
# Note: You are responsible for making sure the required package managers are
|
||||
# installed, eg. through homebrew.
|
||||
composer_packages: []
|
||||
gem_packages: []
|
||||
npm_packages: []
|
||||
pip_packages: []
|
||||
|
||||
# Glob pattern to ansible task files to run after all other tasks are finished.
|
||||
post_provision_tasks: []
|
||||
|
|
3
main.yml
3
main.yml
|
@ -33,6 +33,9 @@
|
|||
when: configure_osx
|
||||
tags: ['osx']
|
||||
|
||||
- include: tasks/extra-packages.yml
|
||||
tags: ['extra-packages']
|
||||
|
||||
- name: Run configured post-provision ansible task files.
|
||||
include: "{{ outer_item }}"
|
||||
loop_control:
|
||||
|
|
31
tasks/extra-packages.yml
Normal file
31
tasks/extra-packages.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- name: Install global Composer packages.
|
||||
composer:
|
||||
command: "{{ (item.state | default('present') == 'absent') | ternary('remove', 'require') }}"
|
||||
arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}"
|
||||
# Ansible 2.4 supports `global_command` making `working_dir` optional.
|
||||
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}"
|
||||
with_items: "{{ composer_packages }}"
|
||||
|
||||
- name: Install global NPM packages.
|
||||
npm:
|
||||
name: "{{ item.name | default(item) }}"
|
||||
version: "{{ item.version | default('latest') }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
global: yes
|
||||
with_items: "{{ npm_packages }}"
|
||||
|
||||
- name: Install global Pip packages.
|
||||
pip:
|
||||
name: "{{ item.name | default(item) }}"
|
||||
version: "{{ item.version | default(omit) }}"
|
||||
state: "{{ item.state | default('latest') }}"
|
||||
with_items: "{{ pip_packages }}"
|
||||
|
||||
- name: Install global Ruby gems.
|
||||
gem:
|
||||
name: "{{ item.name | default(item) }}"
|
||||
version: "{{ item.version | default(omit) }}"
|
||||
state: "{{ item.state | default('latest') }}"
|
||||
user_install: false
|
||||
with_items: "{{ gem_packages }}"
|
Loading…
Reference in a new issue