• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ploy/H20-Aug-2018-4,5793,970

ploy.egg-info/H03-May-2022-828554

.travis.ymlH A D20-Aug-2018218 1716

HISTORY.rstH A D20-Aug-201812.6 KiB568375

MANIFEST.inH A D20-Jun-201472 54

PKG-INFOH A D20-Aug-201827 KiB827553

README.rstH A D03-Oct-20177.3 KiB238159

setup.cfgH A D20-Aug-201838 53

setup.pyH A D20-Aug-20181.6 KiB5246

tox.iniH A D20-Aug-2018381 1916

README.rst

1Overview
2========
3
4Ploy is a commandline-tool to provision, manage and control server instances.
5There are plugins for EC2 (ploy_ec2), FreeBSD Jails (ploy_ezjail) and more.
6You can create, delete, monitor and ssh into instances while ploy handles the details like ssh fingerprint checking.
7Additional plugins provide advanced functionality like integrating Fabric (ploy_fabric) and Ansible (ploy_ansible).
8
9You can find the detailed documentation at http://ploy.readthedocs.org/en/latest/
10
11
12Installation
13============
14
15ploy is best installed with easy_install, pip or with zc.recipe.egg in a buildout.
16It installs two scripts, ``ploy`` and ``ploy-ssh``.
17
18
19Configuration
20=============
21
22All information about server instances is located in ``ploy.conf``, which by default is looked up in ``etc/ploy.conf``.
23
24
25Plugins
26=======
27
28Support for backends and further functionality is implemented by plugins. One plugin is included with ploy.
29
30``plain``
31  For regular servers accessible via ssh.
32
33You can see which plugins are available in your current installation with ``ploy -v``.
34
35
36Plain
37-----
38
39With plain instances you can put infos about servers into the configuration to benefit from some ploy features like ssh fingerprint checking and plugins like the Fabric integration.
40
41
42Options
43~~~~~~~
44
45``host`` or ``ip``
46  (**required**) The host name or address for the server.
47
48``user``
49  The default user for ssh connections. If it's set to ``*`` then the current
50  local user name is used.
51
52``port``
53  The ssh port number.
54
55``ssh-host-keys`` or ``ssh-fingerprints``
56  (**required**) The public ssh host keys (or fingerprints) of the server.
57
58``ssh-host-keys``
59  It's best to use the public ssh host keys if available.
60  You can either specify the path, or put in the contents directly (``ssh-rsa AAAA...``).
61  Multiple host keys can be specified one per line, or separated by commas.
62
63``ssh-fingerprints``
64  If set to ``ask`` then manual interactive verification is enabled.
65  If set to ``ignore`` then no verification is performed at all!
66  Multiple fingerprints can be specified one per line, or separated by commas.
67  The format of fingerprints is either 16 bytes as hex numbers separated by colons,
68  the same 16 bytes prefixed by ``MD5:``,
69  or the hash type, followed by a colon and the base 64 encoded hash digest.
70
71``password-fallback``
72  If this boolean is true, then using a password as fallback is enabled if the
73  ssh key doesn't work. This is off by default.
74  You may be asked more than once for the password.
75  The first time is by paramiko which always happens, but is remembered.
76  The other times is by the ssh command line tool if it's invoked.
77
78``password``
79  Never use this directly! If password-fallback is enabled this password is
80  used. This is mainly meant for Fabric scripts which have other ways to get
81  the password. On use case is bootstrapping `FreeBSD <http://www.freebsd.org/>`_
82  from an `mfsBSD <http://mfsbsd.vx.sk/>`_ distribution where the password is
83  fixed.
84
85``proxycommand``
86  The command to use in the ProxyCommand option for ssh when using the ``ploy-ssh``
87  command. There are some variables which can be used:
88
89    ``path``
90      The directory of the ploy.conf file. Useful if you want to use the ``ploy-ssh``
91      command itself for the proxy.
92
93    ``known_hosts``
94      The absolute path to the known_hosts file managed by ploy.
95
96    ``instances``
97      The variables of other instances. For example: instances.foo.ip
98
99  In addition to these the variables of the instance itself are available.
100
101  A full example for a proxycommand::
102
103    proxycommand = {path}/../bin/ploy-ssh vm-master -W {ip}:22
104
105``ssh-key-filename``
106  Location of private ssh key to use.
107
108``ssh-extra-args``
109  A list of settings separated by newlines passed on to ssh.
110
111  Example::
112
113    ssh-extra-args = ForwardAgent yes
114
115
116SSH integration
117===============
118
119ploy provides an additional tool ``ploy-ssh`` to easily perform SSH based
120operations against named instances. Particularly, it encapsulates the
121entire *SSH fingerprint* mechanism. For example EC2 instances are often
122short-lived and normally trigger warnings, especially, if you are using
123elastic IPs.
124
125  Note:: it does so not by simply turning off these checks, but by transparently updating its own fingerprint list using mechanisms provided by the backend plugins.
126
127The easiest scenario is simply to create an SSH session with an instance. You
128can either use the ssh subcommand of the ploy tool like so::
129
130  ploy ssh INSTANCENAME
131
132Alternatively you can use the ploy-ssh command directly, like so::
133
134  ploy-ssh INSTANCENAME
135
136The latter has been provided to support scp and rsync. Here are some
137examples, you get the idea::
138
139  scp -S `pwd`/bin/ploy-ssh some.file demo-server:/some/path/
140  rsync -e "bin/ploy-ssh" some/path fschulze@demo-server:/some/path
141
142
143Instance names
144==============
145
146Instances have an **id** which is the part after the colon in the configuration.
147They also have a **unique id** which has the form ``[masterid]-[instanceid]``.
148The ``[masterid]`` depends on the plugin.
149For plain instances it is ``plain``.
150The ``[instanceid]`` is the **id** of the instance.
151So, if you have the following config::
152
153  [plain-instance:foo]
154  ...
155
156Then the **unique id** of the instance is ``plain-foo``.
157
158
159Macro expansion
160===============
161
162In the ``ploy.conf`` you can use macro expansion for cleaner configuration
163files. That looks like this::
164
165  [ec2-instance:demo-server2]
166  <= demo-server
167  securitygroups = demo-server2
168
169  [ec2-securitygroup:demo-server2]
170  <= demo-server
171
172All the options from the specified macro are copied with some exceptions depending on the backend plugin.
173
174If you want to copy data from some other kind of options, you can add a colon
175in the macro name. This is useful if you want to have a base for instances
176like this::
177
178  [macro:base-instance]
179  keypair = default
180  region = eu-west-1
181  placement = eu-west-1a
182
183  [ec2-instance:server]
184  <= macro:base-instance
185  ...
186
187
188Massaging of config values
189==========================
190
191Plugins and ploy massage certain string values from the config to convert them to other types and do formatting or expansion.
192
193You can use that yourself, which is useful for the Fabric integration and other things.
194
195Here is a simple example::
196
197  [section]
198  massagers =
199    intvalue=ploy.config.IntegerMassager
200    boolvalue=ploy.config.BooleanMassager
201  intvalue = 1
202  boolvalue = yes
203
204If you now access those values from for example a fabric task, you get the correct type instead of strings.
205
206The above syntax registers the massagers only for that section.
207You can register massagers for other sections or even section groups with this syntax::
208
209  massagers =
210    [option]=[sectiongroup]:import.path.to.massager
211    [option]=[sectiongroup]:[section]:import.path.to.massager
212
213The parts have the following meaning:
214
215  ``[option]``
216    This is the name of the option which should be massaged
217
218  ``[sectiongroup]``
219    The name of the section group.
220    That's the part before the optional colon in a section.
221    To match sections without a colon, use ``global``.
222    To match every section, use ``*``.
223
224  ``[section]``
225    The name of the section to which this massager is applied.
226    If empty, the current section is used.
227
228
229Buildout specifics
230==================
231
232With zc.recipe.egg you can set a custom configfile location like this::
233
234  [ploy]
235  recipe = zc.recipe.egg
236  eggs = ploy
237  arguments = configpath="${buildout:directory}/etc/", configname="servers.cfg"
238