Build a simple lab using podman and systemd, ready for exercising with Ansible, inspired by @mrjackv ansible-nspawn
- systemd
- podman
- buildah
- python
- ssh-keygen, ssh
- ansible
First run the setup
./setup
This script will generate an ssh-key pair, setup the podlab network and then download a centos:stream9
image and perform the following steps on it:
- add podlab labels
- install userful packages (see Included Pakcages)
- add ansible user
- add ansible ssh key
- allow ansible to sudo without password
- add a student user
- allow root login
then start pods with the boot
script, and you can set optionally the ansible gruop to which they will belong.
./boot [group]
You can also use the option -a
to attach directly to the new container.
Finally you can run your playbooks like this:
ansible-playbook ./playbooks/example.yml
After you're done excercising, you can stop the lab with the command
./shutdown
You can also use the -c
option to delete the image and the network. They will be created again next time tou run the setup
script
A quick look at the files and directories included in podlab
.
├── playbooks
├── ansible.cfg
├── boot
├── inventory
├── LICENSE
├── podssh
├── README.md
├── setenv
├── setup
├── shutdown
└── ssh_config
playbooks
: A direcotry where you can place you playbooks. podLAB comes with a playbook namedexample.yml
. You can run it with the commandansible-playbook playbooks/example.yml
ansible.cfg
: The configuration to tell ansible how to connect to podLAB containersboot
: Runs a podLAB container (see usage)inventory
: Inventory script for Ansible in Python, it will filter out any non-podLAB containersLICENSE
: podlab's MIT licensepodssh
: ssh script in podman's unshare net namespace environment, it allows to ssh to any container easily.README.md
: This file :)setenv
: podLABS configurationsetup
: Configures the environment for podLAB's usage (see usage)shutdown
: Stops all podLAB's containers, and optionally clears images and networks (see usage)ssh_config
: The ssh configuration file that allows ansible and manual ssh connection to containers
- basesystem
- bash
- systemd
- openssh-server
- passwd
- sudo
- python3
- yum
- dnf
- findutils
- iproute
- NetworkManager
- iputils
- bind-utils
- procps-ng
- openssh-clients
- nc
- at
- hostname
- acl
- xz
- zip
- info
- wget
- bzip2
- file
- ed
- nano
- quota
- less
- which
- strace
- symlinks
- tcpdump
- time
- tree
- jq
- pinfo
- vim-enhanced
- words
- util-linux-user
MIT License