networking Package

networking Package

Roles in this namespace are meant to provide networking management capabilities.

hosts Module

Roles in this namespace are meant to provide hosts management operations.

class provy.more.linux.networking.hosts.HostsRole(prov, context)[source]

Bases: provy.core.roles.Role

This role provides hosts file management utilities.

Example:

from provy.core import Role
from provy.more.linux import HostsRole

class MySampleRole(Role):
    def provision(self):
        with self.using(HostsRole) as role:
            role.ensure_host('localhost', '127.0.0.1')
ensure_host(host_name, ip)[source]

Makes sure that a certain host is configured in the hosts file.

Parameters:
  • host_name (str) – The hostname.
  • ip (str) – The IP to which the host_name will point to.