Exemplo n.º 1
0
from pyinfra import host
from pyinfra.modules import pkg

SUDO = True

if host.fact.os == 'OpenBSD':

    pkg.packages(
        {'Install Vim and Vim Addon Manager'},
        ['vim-addon-manager', 'vim'],
    )
Exemplo n.º 2
0
# pyinfra
# File: example/roles/bsd_role.py
# Desc: example role that installs pip on (Open)BSD

from pyinfra.modules import server, pkg

# OpenBSD packages?
pkg.packages(['py-pip', 'git'], sudo=True)

# add_pkg does not automatically do this
server.shell('ln -sf /usr/local/bin/pip2.7 /usr/local/bin/pip', sudo=True)
Exemplo n.º 3
0
from pyinfra import host
from pyinfra.modules import apt, pip, pkg, server, yum

# Global flag - this applies to all operations in this file!
SUDO = True

# Only apply to hosts in the `bsd` group
if 'bsd' in host.groups:
    # OpenBSD packages?
    pkg.packages(
        {'Install Python, Pip & Git with pkg_add'},
        ['py-pip', 'git'],
    )

    # add_pkg does not automatically do this
    server.shell(
        {'Symlink pip to pip2.7'},
        'ln -sf /usr/local/bin/pip2.7 /usr/local/bin/pip',
    )

# Work with facts about the remote host
if host.fact.linux_name in ('Ubuntu', 'Debian'):
    apt.packages(
        {'Install Pip & Git with apt'},
        ['git', 'python-pip'],
        update=True,
        cache_time=3600,
    )

elif host.fact.linux_name in ('CentOS', 'Fedora'):
    if host.fact.linux_name == 'CentOS':