Skip to content

Commit 13a944e

Browse files
authored
Merge pull request #39 from stackhpc/feature/etc-hosts
Adds etc-hosts element
2 parents a6b7b34 + 1522b7d commit 13a944e

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

elements/etc-hosts/README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=========
2+
etc-hosts
3+
=========
4+
Appends text to /etc/hosts.
5+
6+
`DIB_ETC_HOSTS_EXTRA`: Lines to add to /etc/hosts
7+
8+
For example:
9+
10+
.. code-block::
11+
12+
export DIB_ETC_HOSTS_EXTRA="192.168.20.1 compute-host-01"
13+
14+
Or:
15+
16+
export DIB_ETC_HOSTS_EXTRA=`cat ./my-hosts`
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
export ETC_HOSTS_EXTRA=${DIB_ETC_HOSTS_EXTRA:?"You must define DIB_ETC_HOSTS_EXTRA"}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4+
set -x
5+
fi
6+
set -eu
7+
set -o pipefail
8+
9+
printf "$ETC_HOSTS_EXTRA" >> /etc/hosts

0 commit comments

Comments
 (0)