VScripts
Automation daemon.
Dependencies
- Ruby >= 1.9.3
- An AWS account (you'll need to create)
Installing
Gem installation
gem install vscripts
Configuration
VScripts looks for a configuration file in the following locations(in order):
- a file specified in the
--config
command line option -
.vscripts.yml
in the $HOME directory /etc/vscripts/config.yml
Usage
vscripts GLOBAL-OPTIONS COMMAND OPTIONS
Global Options
--config, -c <s>: Specify configuration file
--help, -h : Displays VScripts help
--version, -v : Displays the version number
Commands
-
Tags2Facts This command can only be run on an AWS EC2 instance. It looks for all tags associated with it and dumps them in a JSON file. By default this file is
/etc/facter/facts.d/ec2_tags.json
. It can be overridden with the--file
argument. TheName
andDomain
tags are excluded by default because this command is intended to add Facter facts and these 2 already exist in Facter. This behaviour can be overridden by adding[-a|--all]
command line option.Options:
--file, -f <s>: The file that will store the tags (default: /etc/facter/facts.d/ec2_tags.json) --all, -a: Collect all tags --help, -h: Shows help
Examples:
$ vscripts tags2facts $ vscripts tags2facts --file /tmp/my_tags.json --all
-
Identify This command creates a themed host name and fully qualified domain name for the server, using AWS EC2 tags. The default theme is
Group-Role-#
which means that the command collects the value of theGroup
and theRole
AWS EC2 tags (if they are associated with the instance). Additionally, the value of theDomain
tag is also collected so the resulting new host name will beMYGROUP-MYROLE-#.MYDOMAIN
. These tags can be any existing EC2 tags.#
is used as a placeholder for a number. This number starts at 1, and, in case other similarly named instances exist in the current AWS account, it will be incremented accordingly. Once a new host name is composed, both/etc/hostname
and/etc/hosts
are modified on the local instance and a newName
EC2 tag is created and associated with the current instance.If a --host argument is provided it will override the default theme. DOMAIN is still looked up.
If a --domain argument is provided it will override the default domain.
Options:
--ec2-tag-theme, -e <s>: Theme (default: Group-Role-#) --host, -n <s>: Host name --domain, -d <s>: Domain --help, -h: Shows help
Examples:
$ vscripts identify MyGroup-MyRole-1.Example.tld $ vscripts identify --ec2-tag-theme NAME-# MyName-1.Example.tld $ vscripts identify --host myhost --domain example.com myhost.example.com
Contributing
- Fork it ( https://github.com/vghn/vscripts/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
See LICENSE
Changelog
See CHANGELOG