Welcome to Salière’s documentation!¶
Salière is a tool giving people the ability to easily generate a skeleton for a specific project.
Contents:
Usage¶
Synopsis¶
Creates a skeleton for your project.
usage:
saliere [-hlv]
saliere <type> <name> [-c FILE] [-o DIR] [--var VARS]
arguments:
type the type of your template or the path of a jinja template
name the name of your project
options:
-c FILE specify the template configuration file
-h --help show this help message and exit
-l --list list the available templates
-o DIR --output=DIR specify the output directory [default: ./]
-v --version show the version information
--var VARS define the template variables to use
Usage examples¶
Create a Python new vagrant-ansible skeleton:
saliere vagrant-ansible jenkins -c ~/jenkins-template.yml -o ~/vagrant
Use the default values, but override some of them:
saliere vagrant-ansible jenkins -c ~/vagrant-ansible-template.yml -o ~/vagrant --var "{ vm: { memory_size: 4096 } }"
The --var
switch supports 2 syntaxes. Either YAML, either pipe separated key=value pairs:
--var "{ vm_name: enhanced_jenkins, vm_memory_size: 4096 }"
--var "vm_name=enhanced_jenkins|vm_memory_size:=4096"
Configuration file example¶
common:
# Template location. Default values are 'templates', '../templates' and '/usr/local/share/saliere/templates'
template_path:
- 'templates'
- '../templates'
- 'data/templates'
- '../data/templates'
- '/usr/local/share/saliere/templates'
vagrant-ansible:
ansible:
custom_library_paths: library:~/projects/ansible/library
custom_role_paths: roles:~/projects/ansible/roles
groups_common:
vars:
liquidprompt_apply_all_users: True
provisioning_roles:
- sbani.liquidprompt
groups:
ci:
provisioning_roles:
- jenkins
- jenkins_job_builder
cibuilder:
provisioning_roles:
- jenkins_bare_slave
- jenkins_package_builder
vm:
memory_size: 1024
synced_folders:
~/projects/devstack: /opt/devstack
~/projects/engineering/scripts: /opt/scripts
guests:
- name: cibuilder
- name: ci
forwarded_ports:
8080: 8080
Templates¶
Salière is able to generate skeletons for the following project types:
Python¶
To create a skeleton for an ansible provisioned vagrant project:
saliere python python_app -c ~/.saliere/python-template.yml -o ~/python
saliere python python_app -o ~/python --var "{ project_name: python_app, author: Sam Antha, author_email: sam@antha.com, one_line_summary: The best project ever., license: {type: mit, year: 2015} }"
Template variables¶
author
: the name of the author.author_email
: the email of the author.license
: a disctionary containing the license detailstype
: the type of license to use:mit
,apache
, gplv30``year
: the license year
one_line_summary
: one line to describe your project.project_name
: the name of the project.repository
: the reposiroty of the project.
Configuration file¶
Here is an example of configuration file for the python skeleton:
python:
author: Sam Antha
author_email: sam@antha.com
license:
type: mit
year: 2015
one_line_summary: The best project ever!
project_name: Da best app!
repository: https://github.com/samantha/dabestapp
Salt-formula¶
To create a skeleton for a Salt formula:
saliere salt-formula nginx -c ~/salt-formula-template.yml -o ~/salt/formulas
Template variables¶
formula_name
: formula nametoday
: date of the day
Configuration file¶
Here is an example of configuration file for the vagrant-ansible skeleton:
salt-formula:
formula_name: my-salt-formula
today: 2015-02-22
Vagrant-Ansible¶
To create a skeleton for an ansible provisioned vagrant project:
saliere vagrant-ansible jenkins -c ~/jenkins-template.yml -o ~/vagrant
Template variables¶
This template has 2 sections: one describing the ansible parameters, one describing the VMs parameters.
The ansible section¶
custom_library_paths
: path(s) to your ansibles custom libraries. Separate the paths with colons (‘:’).custom_role_paths
: path(s) to your ansibles roles. Separate the paths with colons (‘:’).groups_common
: subsection containing variables and roles to apply to all your groups.vars
: dictionary of variables that are common to all your groups.provisioning_roles
: list of roles that are common to all your groups.
groups
: subsection caontaining the variables and the roles to apply to specific groups.vm_name
: this key is the name of the group to configure.provisioning_roles
: list of roles that are common to apply to this groups.
The VM section¶
memory_size
: the memory size in Megabytes.vm_synced_folders
: a dictionary of directory to sync. The key is the directory on the guest, the value is directory on the host.guests
: a list of dictionary describing the guest vms.name
: the VM name.forwarded_ports
: a dictionary of ports to forward. The key is the port on the guest, the value is port on the host.
Configuration file¶
Here is an example of configuration file for the vagrant-ansible skeleton:
vagrant-ansible:
ansible:
custom_library_paths: library:~/projects/ansible/library
custom_role_paths: roles:~/projects/ansible/roles
groups_common:
vars:
liquidprompt_apply_all_users: True
provisioning_roles:
- sbani.liquidprompt
groups:
ci:
provisioning_roles:
- jenkins
- jenkins_job_builder
cibuilder:
provisioning_roles:
- jenkins_bare_slave
- jenkins_package_builder
vm:
memory_size: 1024
synced_folders:
~/projects/devstack: /opt/devstack
~/projects/engineering/scripts: /opt/scripts
guests:
- name: cibuilder
- name: ci
forwarded_ports:
8080: 8080
Note
Note that for the forwarded_ports
and synced_folders
sections, the key is always the host, and the value the guest.