1Rex::Commands::Host(3)User Contributed Perl DocumentationRex::Commands::Host(3)
2
3
4

NAME

6       Rex::Commands::Host - Edit /etc/hosts
7

DESCRIPTION

9       With this module you can manage the host entries in /etc/hosts.
10

SYNOPSIS

12        task "create-host", "remoteserver", sub {
13          create_host "rexify.org" => {
14           ip    => "88.198.93.110",
15           aliases => ["www.rexify.org"],
16          };
17        };
18

EXPORTED FUNCTIONS

20   host_entry($name, %option)
21       Manages the entries in /etc/hosts.
22
23        host_entry "rexify.org",
24          ensure    => "present",
25          ip        => "88.198.93.110",
26          aliases   => ["www.rexify.org"],
27          on_change => sub { say "added host entry"; };
28
29         host_entry "rexify.org",
30           ensure    => "absent",
31           on_change => sub { say "removed host entry"; };
32
33   create_host($)
34       Update or create a /etc/hosts entry.
35
36        create_host "rexify.org", {
37          ip    => "88.198.93.110",
38          aliases => ["www.rexify.org", ...]
39        };
40
41   delete_host($host)
42       Delete a host from /etc/hosts.
43
44        delete_host "www.rexify.org";
45
46   get_host($host)
47       Returns the information of $host in /etc/hosts.
48
49        my @host_info = get_host "localhost";
50        say "Host-IP: " . $host_info[0]->{"ip"};
51
52
53
54perl v5.30.0                      2019-07-24            Rex::Commands::Host(3)
Impressum