- Add
@docker
connector, to create docker images- eg:
pyinfra @docker/ubuntu:bionic deploy.py
- this will spawn a container, execute operations on it and save it as an image
- eg:
- Add
linux_name
"short" fact - [Experimental]: parse Ansible inventory files (ini format)
- Handle template errors in arguments better
- Capture/handle template syntax errors
- Rename
config.TIMEOUT
->config.CONNECT_TIMEOUT
(old deprecated) - Fix execute
git fetch
before changing branch - Fix
find_in_file
fact for files with~
in the name
Internal changes:
- Remove the
AttrData
and allAttr*
classes now we have operation ordering
- Completely new operation ordering:
- different args will not generate imbalanced operations!
- no more deploy file compile needed
Internal changes:
- Inline
sshuserclient
package (original no longer maintained)
- Fix
deb_package
fact and don't assume we have a version inapt.deb
operation
- Add mysql module
- Operations:
mysql.sql
,mysql.user
,mysql.database
,mysql.privileges
,mysql.dump
,mysql.load
- Facts:
mysql_databases
,mysql_users
,mysql_user_grants
- Operations:
- Add postgresql module
- Operations:
postgresql.sql
,postgresql.role
,postgresql.database
,postgresql.dump
,postgresql.load
- Facts:
postgresql_databases
,postgresql_roles
- Operations:
- Add puppet module with
puppet.agent
operation (@tobald) - Add
server.crontab
,server.modprobe
andserver.hostname
operations - Add
git.config
operation - Add
kernel_modules
,crontab
andgit_config
facts - Add global install virtualenv support (like iPython)
- Massively improved progress bar which highlights remaining hosts and tracks progress per operation or fact
- Improved SSH config parsing, including proxyjump support (@tobald)
- Support for CONFIG variables defined in
local.include
files - Fix
command
fact now outputs everything not just the first line
Internal changes:
- Replace
--debug-state
with--debug-operations
and--debug-facts
- pyinfra now compiles the top-level scope of deploy code, meaning if statements no longer generate imbalanced operations
- This means the recommendations to use
state.when
in place of conditional statements is invalid - Updated the warning shown, now once, with a link
- Included a test
deploy_branches.py
which can be used to verify operations do run in order for each host when compile is disabled - Compiling can be disabled by setting
PYINFRA_COMPILE=off
environment variable
- This means the recommendations to use
- Deprecate
state.limit
and replace withstate.hosts(hosts)
(consistency with global operation kwarghosts
notlimit
) - Major internal refactor of
AttrData
handling to reduce operation branching:- Generate
AttrData
on creation, rather than read - Add nesting support for
AttrData
sohost.data.thing['X']
will not create branching operations - Turn fact data into
AttrData
- Make
host.name
anAttrDataStr
- Hash
True
,False
andNone
constants as the same so they can change between hosts without branching operations - Update docs and warning on operation branching
- Generate
- Better default for pool parallel size
- Show stdout if stderr is empty on command failure (surprisingly common)
- Fix file "uploading" for the
@local
connector
- Make
--limit
apply the limit similarly tostate.limit
- makes it possible to execute facts on hosts outside the
--limit
--limit
no longer alters the inventory, instead provides an "initial" state limit
- makes it possible to execute facts on hosts outside the
- Add
when=True
kwarg tolocal.include
- Make it possible to add
data
to individual hosts in@vagrant.json
configuration files - Add
memory
andcpus
facts - Refactor how we track host state throughout deploy
- Refactor facts to only gather missing ones (enabling partial gathering)
- Improve check for valid
/etc/init.d/
services by looking for LSB header - Fix boolean constant detection with AST in Python3
- Fix parsing ls output where
setgid
is set - Fix sudo/su file uploads with the
@local
connector
- Fix writing unicode data with
@local
- Capture
IOError
s when SFTPing, note where remote disks might be full - Properly serialise
Host
objects for--debug-state
- Add
exclude_dir
andadd_deploy_dir
kwargs tofiles.sync
- Add pipfile for dev
- Fix
files.put
when using@local
- Make environment variables stick between multiple commands
- Fix npm packages fact missing a return(!)
What was originally a module release for pyinfra (see the 0.6 milestone!) has become all about proper conditional branching support (previously resulted in best-effort/guess operation order) and improving 0.4's initial @deploy
concept:
- Add global
when
kwarg to all operations, similar tohosts
can be used to prevent operations executing on hosts based on a condition - Add
state.limit(hosts)
andstate.when(condition)
context managers to use in place ofif
statements within deploys @deploy
s and the context managers (state.limit
,state.when
) can all be nested as much as needed (although if you need to nest a lot, you're probably doing it wrong!)- Add
data_defaults
kwarg to@deploy
functions, meaning third party pyinfra packages can provide sensible defaults that the user can override individually - Display a large warning when imbalanced branches are detected, linking the user to the documentation for the above
Note that if statements/etc still work as before but pyinfra will print out a warning explaining the implications and linking to the docs (http://pyinfra.readthedocs.io/page/using_python.html#conditional-branches).
- Vagrant connector:
# Run a deploy on all Vagrant machines (vagrant status list)
pyinfra @vagrant deploy.py
pyinfra @vagrant/vm_name deploy.py
# Can be used in tandem with other inventory:
pyinfra @vagrant,my-host.net deploy.py
pyinfra @vagrant,@local,my-host.net fact os
- Hooks broken: no longer loaded from deploy files, only from
config.py
, due to changes from0.4
(removal ofFakeState
nonsense) - Add
gpgkey
argument to theyum.repo
operation - Add
lsb_release
fact apt_sources
fact now supports apt repos with options ([arch=amd64]
)- Improved error output when connecting
- Update testing box from Ubuntu 15 to Ubuntu 16
- Ensure
~/.ssh
exists keyscanning inssh.keyscan
- Don't include tests during setup!
- Fix caching of local SHA1s on files
- Add
vzctl.unmount
operation (missing from 0.4!) - Add script to generate empty test files
- Increase module test coverage significantly
- Fix incorrect args in
vzctl.restart
operation - Fix
save=False
kwarg onvzctl.set
not affecting command output (always saved) - Fix
gem.packages
install command
- 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
from pyinfra.modules import apt
@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
To-be-breaking changes (deprecated):
- Deprecate
add_limited_op
function, usehosts
kwarg onadd_op
- Deprecate group access via attribute and host access via index on
Inventory
Inventory.get_group
andinventory.get_host
replace
- Add
init.service
operation - Add
config.MIN_PYINFRA_VERSION
- Add
daemon_reload
toinit.systemd
- Add
pip
path topip.packages
(@hoh) - Add
virtualenv_kwargs
topip.packages
- Add
socket
fact - Display meta and results in groups
- Fact arguments now parsed with jinja2 like operation args
- Use full dates in
file
,directory
andlink
facts - Improve
--run
check between operation and/or shell - Improve tests with facts that have multiple arguments
- Fix how
pip.packages
handles pip path - Fix
yum.rpm
when downloading already installed rpm's - Fix
users
fact with users that have no home directory - Fix command overrides with dict objects (git.repo)
- Removed compatibility for deprecated changes in v0.2
- Fix bug in parsing of network interfaces
- Fix
--limit
with a group name
- Use wget & pipe when adding apt keys via URL, rather than
apt-key adv
which breaks with HTTPs - Fix bug where file-based group names were uppercased incorrectly (ie dev.py made group DEV, rather than dev)
New stuff:
- Add LXD facts/module
- Add iptables facts/module
- Support usernames with non-standard characters (_, capitals, etc)
- Add global
get_pty
kwarg for all operations to work with certain dodgy programs - Add
--fail-percent
CLI arg - Add
exclude
kwarg tofiles.sync
- Enable
--limit
CLI arg to be multiple, comma separated, hostnames - Add
no_recommends
kwarg toapt.packages
operation - Make local imports work like calling
python
by adding.
tosys.path
in CLI - Add key/value release meta to
linux_distribution
fact - Improve how the init module handles "unknown" services
- Add
force
kwarg toapt.packages
andapt.deb
and don't--force-yes
by default
To-be-breaking changes (deprecated):
- Switch to lowercase inventory names (accessing
inventory.bsd
where the group is defined asBSD = []
is deprecated) - Rename
yum.upgrade
->yum.update
(yum.upgrade
deprecated) - Deprecate
pip_virtualenv_packages
fact aspip_packages
will now accept an argument for the virtualenv - Deprecate
npm_local_packages
fact asnpm_packages
will accept an argument for the directory
Internal changes:
- Operations now
yield
, rather than returning lists of commands
- Fix
--run
arg parsing splutting up[],
- Enable passing of multiple, comma separated hosts, as inventory
- Use
getpass
, notraw_input
for collecting key passwords in CLI mode
- Fix issue when removing users that don't exist
- Improve private key error handling
- Ask for encrypted private key passwords in CLI mode
- Don't generate set groups when
groups
is an empty list inserver.user
.
- First versioned release, start of changelog
- Full docs @ pyinfra.readthedocs.io
- Core API with CLI built on top
- Two-step deploy (diff state, exec commands)
- Compatibility tested w/Ubuntu/CentOS/Debian/OpenBSD/Fedora
- Modules/facts implemented:
- Apt
- Files
- Gem
- Git
- Init
- Npm
- Pip
- Pkg
- Python
- Server
- Yum