---
name: "cdist-type__hosts"
section: "7"
platform: "linux"
package: "cdist"
version: "7.0.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cdist-type__hosts"
---

# cdist-type\_\_hosts(7)

manage entries in /etc/hosts

## NAME

cdist-type\_\_hosts - manage entries in /etc/hosts

## DESCRIPTION

Add or remove entries from */etc/hosts* file.

## OPTIONAL PARAMETERS

- **state**

  If state is **present**, make *object\_id* resolve to *ip*. If state is **absent**, *object\_id* will no longer resolve via */etc/hosts*, if it was previously configured with this type. Manually inserted entries are unaffected.

- **ip**

  IP address, to which hostname (=*object\_id*) must resolve. If state is **present**, this parameter is mandatory, if state is **absent**, this parameter is silently ignored.

- **alias**

  An alias for the hostname. This parameter can be specified multiple times (once per alias).

## EXAMPLES

```
# Now `funny' resolves to 192.168.1.76,
__hosts funny --ip 192.168.1.76
# and `happy' no longer resolve via /etc/hosts if it was
# previously configured via __hosts.
__hosts happy --state absent
__hosts srv1.example.com --ip 192.168.0.42 --alias srv1
```

## SEE ALSO

[**hosts**(5)](/hosts/5.md)

## AUTHORS

```
Dmitry Bogatov <KAction@gnu.org>
Dennis Camera <dennis.camera--@--ssrq-sds-fds.ch>
```

## COPYING

Copyright (C) 2015-2016 Dmitry Bogatov, 2019 Dennis Camera. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

## COPYRIGHT

ungleich GmbH 2021
