from pyinfra import host, state from pyinfra.operations import apt, files, mysql, python SUDO = True if host.fact.linux_name != 'Debian': # Raises an exception mid-deploy python.raise_exception( {'Ensure we are Debian'}, NotImplementedError, '`mysql.py` only works on Debian', ) apt.packages( {'Install mysql server & client'}, ['mysql-server'], update=True, cache_time=3600, ) # Setup a MySQL role & database # mysql.user( {'Create the pyinfra@localhost MySQL user'}, 'pyinfra', password='******', ) mysql.database( {'Create the pyinfra_stuff database'},
from pyinfra import host, state from pyinfra.operations import apt, files, postgresql, python SUDO = True if host.fact.linux_name != 'Ubuntu': # Raises an exception mid-deploy python.raise_exception( name='Ensure we are Ubuntu', exception=NotImplementedError, args=('`postgresql.py` only works on Ubuntu',), ) apt.packages( name='Install postgresql server & client', packages=['postgresql'], update=True, cache_time=3600, ) # Setup a PostgreSQL role & database # postgresql.role( name='Create the pyinfra PostgreSQL role', role='pyinfra', password='******', superuser=True,
from pyinfra import host, state from pyinfra.operations import apt, files, mysql, python SUDO = True if host.fact.linux_name != 'Debian': # Raises an exception mid-deploy python.raise_exception( name='Ensure we are Debian', exception=NotImplementedError, args=('`mysql.py` only works on Debian', ), ) apt.packages( name='Install mysql server & client', packages=['mysql-server'], update=True, cache_time=3600, ) # Setup a MySQL role & database # mysql.user( name='Create the pyinfra@localhost MySQL user', user='******', password='******', ) mysql.database( name='Create the pyinfra_stuff database',
from pyinfra import host, state from pyinfra.operations import apt, files, postgresql, python SUDO = True if host.fact.linux_name != 'Ubuntu': # Raises an exception mid-deploy python.raise_exception( {'Ensure we are Ubuntu'}, NotImplementedError, '`postgresql.py` only works on Ubuntu', ) apt.packages( {'Install postgresql server & client'}, ['postgresql'], update=True, cache_time=3600, ) # Setup a PostgreSQL role & database # postgresql.role( {'Create the pyinfra PostgreSQL role'}, 'pyinfra', password='******', superuser=True, login=True, sudo_user='******', )