Changes in 0.4:
- Major change: entirely new, streamlined CLI. Legacy support will remain for the next few releases. Usage is now:
# Run one or more deploys against the inventory
pyinfra INVENTORY deploy_web.py [deploy_db.py]...
# Run a single operation against the inventory
pyinfra INVENTORY server.user pyinfra,home=/home/pyinfra
# Execute an arbitrary command on the inventory
pyinfra INVENTORY exec -- echo "hello world"
# Run one or more facts on the inventory
pyinfra INVENTORY fact linux_distribution [users]...
- Major addition: new
connectors
module that means hosts are no longer limited to SSH targets. Hostnames prefixed in@
define which non-SSH connector to use. There is a newlocal
connector for executing directly on the local machine, use hostname@local
, eg:
pyinfra @local fact arch
- Major addition: add
@deploy
wrapper for pyinfra related modules (eg pyinfra-openstack) to wrap a deploy (collection of operations) under one function, eg:
from pyinfra.api import deploy
@deploy('Install Openstack controller')
def install_openstack_controller(state, host):
apt.packages(
state, host,
{'Install openstack-client'},
['openstack-client'],
)
...
- Add SSH module to execute SSH from others hosts:
ssh.keyscan
,ssh.command
,ssh.upload
,ssh.download
- Add vzctl module to manage OpenVZ containers:
vzctl.create
,vzctl.stop
,vzctl.start
,vzctl.restart
,vzctl.delete
,vzctl.set
- Add
on_success
andon_error
callbacks to all operations (args =(state, host, op_hash)
) - Add
server.script_template
operation - Add global
hosts
kwarg to all operations, working likelocal.include
's - Add
cache_time
kwarg toapt.update
operation - Add
Inventory.get_group
andInventory.get_host
- Inventory
__len__
now (correctly) looks at active hosts, rather than all - Add
Inventory.len_all_hosts
to replace above bug/qwirk - Add progress spinner and % indicator to CLI
- Replace
docopt
/termcolor
withclick
- Moved
pyinfra.cli
topyinfra_cli
(internal breaking) - Switch to setuptools
entry_points
instead of distutils scripts - Expand Travis.ci testing to Python 3.6 and 3.7 nightly
- Remove unused kwargs (
sudo
,sudo_user
,su_user
) frompyinfra.api.facts.get_facts