- Overview
- Requirements
- Role Variables
- Dependencies
- Examples
- Development / Contributing
- License
- Author Information
This role installs and manages the SCL Software Collections repository, packages/collections for Fedora, CentOS, and Scientific Linux. Additionally it can create wrapper wrapper scripts to make calling the SCL collections binaries
This role has been tested with Ansible 2.9 or higher and platform requirements are listed in the metadata file.
This role has been tested against the following distributions and Ansible version:
- | Distribution | Ansible 2.9 |
---|---|---|
- | Centos 6 | yes |
- | Centos 7 | yes |
If you are looking for a version compatible with an older Ansible release please see the legacy branch
The variables that can be passed to this role and a brief description about them are as follows. (For all variables, take a look at defaults/main.yml)
# Toggle to enable creation/management
# of the SCL YUM repositories
scl_manage_repo: yes
# The Base URL location of the SCL sclo repository
scl_repo_sclo_sclo_baseurl:
"http://mirror.centos.org/centos/{{ ansible_distribution_major_version }}/sclo/$basearch/sclo/"
# The Base URL location of the SCL rh repository
scl_repo_sclo_rh_baseurl:
"http://mirror.centos.org/centos/{{ ansible_distribution_major_version }}/sclo/$basearch/rh"
# Array of wrapper scripts to create for SCL installed binaries
scl_wrappers:
- {collection: 'rh-ruby23', command: 'ruby'}
- {collection: 'rh-python35', command: 'python'}
# Array of Collections/Packages to install via SCL
scl_packages:
- {name: 'rh-ruby23', state: 'latest'}
- {name: 'rh-python35', state: 'latest'}
# Array (of hashes) of Ruby Gems to manage
scl_ruby_gems:
- {
ruby_ver: 'rh-ruby23',
name: 'fast_github',
state: 'present',
}
# Array (of hashes) of Python PIPs to manage
scl_python_pips:
- {
python_ver: 'rh-python35',
name: 'snakeoil',
state: 'present',
}
None
- Management of the SCL YUM repositories
roles:
- role: ansible-role-scl
scl_manage_repo: false
roles:
- role: ansible-role-scl
scl_repo_sclo_sclo_baseurl:
"http://mylocalmirror.local/centos/6/sclo/$basearch/sclo/"
-
Install wrapper scripts for SCL installed binaries
The variable
scl_wrappers
generates wrapper/shebang scripts in/usr/local/bin
:Each entry requires a hash with:
collection
(required)command
(optional)
If the command key is omited an scl wrapper script will be created
scl-wrappper-[collection name]
that can be used to call any command with with the collection sourced via SCL. For example listing all the PIPs installed under SCL rh-python35scl-wrapper-rh-python35 pip list
If the command key is set an scl shebang script will be created that points to the command/binary specified.
scl-shebang-[collection name]
that can be used for inclusion in scripts. For example put the following in the wrapper line of a script written in ruby 2.2#!/usr/local/bin/scl-shebang-rh-ruby22
The script will properly source all necessary environment variables for the desired ruby environment without having to declare
scl enable rh-ruby22 -- ruby my_script.rb
each timemy_script.rb
is runroles: - role: ansible-role-scl scl_wrappers: - {collection: 'rh-ruby22', command: 'ruby'} - {collection: 'rh-python35', command: 'python'}
-
Install SCL collections/packages via yum module
Pre-compiled Gems/PIPs packages (RPMs) can be installed via the scl_packages variable.
Each entry requires a hash with:
name
(required)state
(optional)[defaults: present]
roles: - role: ansible-role-scl scl_packages: - {name: 'rh-ruby22', state: 'latest'} - {name: 'rh-python35', state: 'latest'}
-
Manage SCL Python PIPs via pip module
Each entry requires a hash with:
ruby_ver
(required)name
(required)state
(optional)[defaults: present]version
(optional)[defaults: omit]
roles: - role: ansible-role-scl scl_python_pips - { python_ver: 'rh-python35', name: 'snakeoil', state: 'present', }
-
Manage SCL Ruby GEMs via gem module
Each entry requires a hash with:
python_ver
(required)name
(required)state
(optional)[defaults: present]version
(optional)[defaults: omit]source
(optoinal)[defaults: omit]pre_release
(optional)[defaults: no]
roles: - role: ansible-role-scl scl_ruby_gems - { ruby_ver: 'rh-ruby23', name: 'fast_github', state: 'present', }
-
AIO Example
- role: ansible-role-scl scl_wrappers: - {collection: 'rh-ruby23', command: 'ruby'} - {collection: 'rh-python35', command: 'python'} scl_packages: - {name: 'rh-ruby23', state: 'latest'} - {name: 'rh-python35', state: 'latest'} scl_ruby_gems: - { ruby_ver: 'rh-ruby23', name: 'fast_github', state: 'present', } scl_python_pips: - { python_ver: 'rh-python35', name: 'snakeoil', state: 'present', }
-
Ansible
include_role
notation(s)Examples of including roles and tasks from the SCL Role using the new include_role module in Ansible 2.2+
These examples give Ansible a more modular, class like feel which allows portions of a role to be included inside of additional playbooks with less duplication
tasks: - name: "Add wrapper script for rh-ruby22" include_role: name: ansible-role-scl tasks_from: wrappers vars: scl_wrappers: - {collection: 'rh-ruby22', command: 'ruby'} - name: "Install rh-ruby22 from SCL" include_role: name: ansible-role-scl tasks_from: packages vars: scl_packages: - {name: 'rh-ruby22'} - name: "Install gems for rh-ruby22" include_role: name: ansible-role-scl tasks_from: gems vars: scl_ruby_gems: - { ruby_ver: 'rh-ruby22', name: 'fast_github', state: 'present', }
See Contributing.
Note: This role is currently only tested against the following OS and Ansible versions:
- CentOS 6.x
- CentOS 7.x
- 2.9.0
Licensed under the MIT License. See the LICENSE file for details.
- Steven Bambling