Prerequisites: Docker, Ansible on Windows 10+ WSL2 or Linux with Ansible and Docker insatlled
To insatll WSL, please follow Microsoft guide at https://docs.microsoft.com/en-us/windows/wsl/install
Docker Instruction can be found here:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh
- Clone the repo
- Ensure the script has execution permission set for the user. if it's not set, set it using
sudo chmod u+x createinfra.sh
- Install Ansible on WSL using
sudo apt get install ansible
- Install docker
- Add the logged in user to the docker group using
sudo usermod -aG docker $USER
- To create the infrastructure, run ./createinfra.sh -create x where x is the number of containers you want created
- After creating the infrastructure, the script will create a playbooks directory with the inventory file
inventory
- To verify the created invenory, run
ansible all -i playbooks/inventory -m ping
- To delete the created inventory and start fresh, run
./createinfra.sh -delete
the delete the playbooks directory usingrm -rf playbooks
- Install Ansible
- Install docker
- add the current logged user to docker group
sudo usermod -aG docker $USER
- clone the repo
- Set execution permission on createinfra.sh
sudo chmod u+x createinfra.sh
- Excute the script and create containers using
./createingfra.sh -create 5
#Note: This script assumes the logged in user is a member of the docker group. to add the user, use sudo usermod -aG docker $USER
To run the one or more of the containers manually, run the following
docker run -rm -tid --cap-add NET_ADMIN --cap-add SYS_ADMIN --publish-all=true -v /srv/data:/srv/html -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name {REPLACE_WITH_CONTAINER_NAME} -h {REPLACE_WITH_CONTAINER_NAME} sageil/ansible-env