# Ensure the state of git repositories git.repo( '[email protected]:Fizzadar/pyinfra', host.data.app_dir, branch='develop', ssh_keyscan=True, run_once=True, sudo=True, # Carry SSH agent details w/sudo preserve_sudo_env=True, ) # Manage pip (npm, gem) packages did_install = pip.packages( ['virtualenv'], sudo=True, ) # use operation meta to affect the deploy server.shell( 'echo "Clean package build/etc"', when=did_install.changed, ) # Create a virtualenv server.shell( 'virtualenv {{ host.data.env_dir }}', sudo=True, sudo_user='******', ) # and manage pip within it pip.packages(
# Ensure the state of git repositories git.repo( {'Clone pyinfra repository'}, '[email protected]:Fizzadar/pyinfra', host.data.app_dir, branch='develop', ssh_keyscan=True, sudo=True, # Carry SSH agent details w/sudo preserve_sudo_env=True, ) # Manage pip packages did_install = pip.packages( {'Install virtualenv with pip'}, ['virtualenv'], sudo=True, ) # Use operation meta to affect the deploy if did_install.changed: server.shell( 'echo "Clean package build/etc"', ) # Create a virtualenv server.shell( {'Setup the virtualenv'}, 'virtualenv {{ host.data.env_dir }}', sudo=True, sudo_user='******', )
cache_time=3600, ) elif host.fact.linux_name in ('CentOS', 'Fedora'): if host.fact.linux_name == 'CentOS': # Both missing in the CentOS 7 Vagrant image yum.packages( {'Install wget & net-tools with yum'}, ['wget', 'net-tools'], ) # Manage remote rpm files yum.rpm( {'Install epel RPM'}, ('https://dl.fedoraproject.org/pub/epel/epel-release-latest-' '{{ host.fact.linux_distribution.major }}.noarch.rpm'), ) # yum package manager yum.packages( {'Install Pip & Git with yum'}, ['git', 'python-pip'], ) # Now that we installed pip, we can use it! Note that this operation will be # run after all the branches above. pip.packages( {'Install a pip package'}, 'pytask', )