大网数据广告活动
服务器运维问答

What is the equivalent of r10k in Ansible?

· 52CE 我爱测

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

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。