Librarian resource

This commit is contained in:
Łukasz Oleś 2015-10-11 23:40:51 +02:00
parent b24e2a33cd
commit 493fcb1151
4 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,6 @@
- hosts: [{{host}}]
sudo: yes
tasks:
#XXX: should we remove modules also?
- file: path={{config_dir}}/Puppetfile state=absent
- shell: gem uninstall librarian-puppet

View File

@ -0,0 +1,9 @@
- hosts: [{{host}}]
sudo: yes
tasks:
# XXX: check apt package http://packages.ubuntu.com/trusty/ruby/librarian-puppet
- shell: gem install librarian-puppet --no-ri --no-rdoc
- template:
src={{templates_dir}}/Puppetfile
dest={{config_dir}}/Puppetfile
- shell: librarian-puppet install chdir={{config_dir}}

View File

@ -0,0 +1,14 @@
id: librarian
handler: ansible
version: 0.0.1
input:
modules:
schema: [str]
value: []
reverse: True
config_dir:
schema: str!
value: /etc/puppet
forge:
schema: str!
value: https://forgeapi.puppetlabs.com

View File

@ -0,0 +1,24 @@
forge "{{forge}}"
{%- for module in modules %}
{% if 'type' not in module or module.type == 'forge' -%}
mod '{{module.name}}'
{%- if 'version' in module -%}
, '{{module.version}}'
{%- endif -%}
{%- endif -%}
{%- if 'type' in module and module.type == 'git' -%}
mod '{{module.name}}'
{%- if 'url' in module -%}
,
:git => '{{module.url}}'
{%- endif -%}
{%- if 'ref' in module -%}
,
:ref => '{{module.ref}}'
{%- endif -%}
{%- endif -%}
{%- endfor -%}