Infrastructure deployment for VMs using Ansible.
Repository contains simulated VMs aganst which you may run the deployment playbooks. Linting and automation is out of scope of this repo.
Also check the community version!
-
Setup and activate python virtual environment.
python3 -m venv venv source venv/bin/activate
-
Make sure python requirements are installed:
pip install -r requirements.txt
-
Start simulation VMs:
docker compose up -d
NOTE that the simulator generates new SSH keys each time the docker image is rebuilt, thus, when you ssh into containers, you will get your
known_hosts
polluted. You should clean it up after use... -
Move to the ansible folder, list hosts and ping simulator VMs
cd ansible ansible -i inventory/simulator.yaml all --list-hosts ansible -i inventory/simulator.yaml all -m ping
-
Install Consul:
ansible-playbook -i inventory/simulator.yaml playbooks/local-simulator.yaml
-
Try to connect with a consul client(
docker exec consul-client consul members
) should return something like:Node Address Status Type Build Protocol DC Partition Segment server1 192.168.160.3:8301 alive server 1.15.1 2 dc-test default <all> server2 192.168.160.5:8301 alive server 1.15.1 2 dc-test default <all> server3 192.168.160.2:8301 alive server 1.15.1 2 dc-test default <all> client1 192.168.160.4:8301 alive client 1.15.1 2 dc-test default <default>
-
Open UI:
open http://localhost:8500/
Simulated VMs are nothing more than docker containers with python and sshd agent installed and running.
They may be started using the docker-compose.yaml
, which will also bring up the Consul client.
- python3 (v3.8 or grater) using
venv
for virtual environments - when using simulator, docker with docker compose is used
- knowledge of Ansible