Examples
>Table of Contents<
- Tutorial
- Local invocation of scripts
- Run scripts inside a local container
- Run scripts remote via SSH
- Install podman to remote Ubuntu 20.04 host
Tutorial
In the Git source tree, the TUTORIAL directory contains a hierarchy that persistently enables IP forwarding through sysctl upon the remote SSH host named avocado
First you have to setup SSH public-key authentication for a remote host with hostname avocado
. It’s important that the hostnames match.
Once that is done, you can proceed with the example:
cd TUTORIAL
rr avocado sysctl:apply
Steps that rr
performs
- Copies
.files-avocado/
toavocado:/
- Generates the script:
#!/bin/sh
unset IFS
set -efu
PATH=/bin:/sbin:/usr/bin:/usr/sbin
LC_ALL=C
sysctl --system
- Runs the script on host avocado via SSH.
Local invocation of scripts
Run locally, the default without a hostname or container PID specified.
Requires tar(1)
for .files
The following are equivalent:
rr namespace:script
rr localhost namespace:script
Run scripts inside a local container
NOTE: Linux only
Run on a local container’s PID via nsenter(1)
. Requires tar(1)
for .files
.
rr 1333 namespace:script
Run scripts remote via SSH
Requires OpenSSH 4.7+ for .files
.
rr remotehost namespace:script
If a file named rr.hosts
is in the current directory then that is used as the SSH config instead of the default
~/.ssh/config
.
Install podman to remote Ubuntu 20.04 host
$ mkdir -p examples/install-podman
$ cat > examples/install-podman/script <<-'EXAMPLE'
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | apt-key add -
apt-get update
apt-get -y upgrade
apt-get -y install podman
EXAMPLE
$ cat rr.hosts
Host remotemost
Hostname 203.0.113.1
User root
$ rr remotehost example:install-podman
...
...