Merge pull request #248 from loles/librarian_resource
Librarian resource
This commit is contained in:
commit
df18ed61c7
15
examples/librarian/README
Normal file
15
examples/librarian/README
Normal file
@ -0,0 +1,15 @@
|
||||
Usage
|
||||
=====
|
||||
|
||||
Run it from /vagrant dir:
|
||||
|
||||
```
|
||||
solar resource clear_all
|
||||
solar resource create nodes templates/nodes.yaml '{"count": 1}'
|
||||
solar resource create librarian_example examples/librarian/librarian.yaml '{"node": "node1"}'
|
||||
|
||||
solar changes stage
|
||||
solar changes process
|
||||
solar orch run-once
|
||||
solar orch report -w 100
|
||||
```
|
21
examples/librarian/librarian.yaml
Normal file
21
examples/librarian/librarian.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
id: librarian_examples
|
||||
|
||||
resources:
|
||||
- id: librarian
|
||||
location: {{node}}
|
||||
from: resources/librarian
|
||||
values:
|
||||
modules_path: /tmp/x/x/modules
|
||||
modules:
|
||||
- name: puppetlabs-ntp
|
||||
version: 4.1.0
|
||||
- name: puppet-keystone
|
||||
type: git
|
||||
url: https://github.com/openstack/puppet-keystone
|
||||
ref: 5.1.0
|
||||
|
||||
events:
|
||||
- type: depends_on
|
||||
parent_action: librarian.run
|
||||
state: success
|
||||
depend_action: rabbitmq_service1.run
|
6
resources/librarian/actions/remove.yaml
Normal file
6
resources/librarian/actions/remove.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
- hosts: [{{host}}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- file: path={{modules_path}} state=absent
|
||||
- file: path={{modules_path}}/../Puppetfile state=absent
|
||||
- shell: gem uninstall librarian-puppet
|
10
resources/librarian/actions/run.yaml
Normal file
10
resources/librarian/actions/run.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
- 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
|
||||
- file: path={{modules_path}} state=directory
|
||||
- template:
|
||||
src={{templates_dir}}/Puppetfile
|
||||
dest={{modules_path}}/../Puppetfile
|
||||
- shell: librarian-puppet install chdir={{modules_path}}
|
13
resources/librarian/meta.yaml
Normal file
13
resources/librarian/meta.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
id: librarian
|
||||
handler: ansible
|
||||
version: 0.0.1
|
||||
input:
|
||||
modules:
|
||||
schema: [str]
|
||||
value: []
|
||||
modules_path:
|
||||
schema: str!
|
||||
value: /etc/puppet/modules
|
||||
forge:
|
||||
schema: str!
|
||||
value: https://forgeapi.puppetlabs.com
|
24
resources/librarian/templates/Puppetfile
Normal file
24
resources/librarian/templates/Puppetfile
Normal 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 -%}
|
Loading…
x
Reference in New Issue
Block a user