问题原文
原帖链接 · 030 · CC BY-SA 3.0
Puppet modules like the ones from puppetforge could be deployed using r10k.
Question
What is the equivalent of this tool in Ansible?
Attempt to answer the question
This Google Q&A was found that does not answer the question
已采纳解答
原帖链接 · 030 · CC BY-SA 3.0
Based on the discussion with @ceejayoz the conclusion is that Ansible's equivalent of Puppet's R10K is ansible-galaxy install -r requirements.yml.
R10K
In R10K a Puppetfile is used. A Puppetfile is a definition of modules (e.g. from Puppetforge) that need to be assembled in a certain environment, e.g. the Puppetfile of the development environment could look as follows:
mod 'garethr/docker', '5.3.0'
mod 'unibet/vagrant', '0.2.1'
mod 'jenkins',
:git => 'https://github.com/jenkinsci/puppet-jenkins',
:ref => 'master'
mod 'jdk_oracle',
:git => 'https://github.com/schrepfler/puppet-jdk_oracle.git',
:ref => 'master'
While the Production Puppetfile contains stable versions:
mod 'garethr/docker', '5.2.0'
mod 'unibet/vagrant', '0.2.0'
mod 'schrepfler/puppet-jdk_oracle', '0.2.0'
mod 'rtyler/jenkins', '1.6.1'
The equivalent of r10k in ansible
In order to assemble roles (equivalent of Puppet's modules) from Puppet's Puppetforge equivalent in Ansible - Ansible Galaxy or custom sources the roles or sources could be defined in yml files (based on the link provided by @ceejayoz and this link). The development environment could look as follows:
development.yml
- src: geerlingguy.composer
version: 1.3.0
- src: geerlingguy.java
version: 1.2.1
- src: bennojoy.mysql
- src: https://github.com/ANXS/postgresql.git
version: master
and it could be run by issuing sudo ansible-galaxy install -r development.yml. While the production could look like:
production.yml
- src: geerlingguy.composer
version: 1.2.0
- src: geerlingguy.java
version: 1.1.1
and be run by executing sudo ansible-galaxy install -r production.yml. The outcome could look as follows:
user@host ~ $ sudo ansible-galaxy install -r development.yml
- geerlingguy.composer is already installed, skipping.
- downloading role 'java', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-java/archive/1.2.1.tar.gz
- extracting geerlingguy.java to /etc/ansible/roles/geerlingguy.java
- geerlingguy.java was installed successfully
- bennojoy.mysql is already installed, skipping.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
