This guide provides an Ansible playbook to install GNS3 server dependencies and prepare the system for Docker-based deployment.
GNS3 does not have native system packages for the full server. The recommended deployment is:
- name: Prepare GNS3 Server Host
hosts: gns3
become: true
vars:
docker_users: ["{{ ansible_user_id }}"]
gns3_dir: /opt/gns3
tasks:
- name: Update apt cache
apt:
update_cache: true
cache_valid_time: 3600
when: ansible_os_family == "Debian"
- name: Install KVM and virtualization packages
apt:
name:
- qemu-kvm
- libvirt-daemon-system
- libvirt-clients
- bridge-utils
- virtinst
state: present
when: ansible_os_family == "Debian"
- name: Enable and start libvirt
service:
name: libvirtd
state: started
enabled: true
- name: Add user to libvirt group
user:
name: "{{ ansible_user_id }}"
groups: libvirt
append: true
- name: Install Docker prerequisites
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
- name: Add Docker GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker repository
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
- name: Install Docker
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present
update_cache: true
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Add user to Docker group
user:
name: "{{ ansible_user_id }}"
groups: docker
append: true
- name: Create GNS3 directory
file:
path: "{{ gns3_dir }}"
state: directory
mode: "0755"
- name: Verify KVM support
command: kvm-ok
register: kvm_check
changed_when: false
failed_when: false
- name: Display KVM status
debug:
msg: "KVM support: {{ 'Available' if kvm_check.rc == 0 else 'Not available - performance may be limited' }}"
/opt/gns3/docker-compose.yml (see Docker setup guide)cd /opt/gns3
docker compose up -d
Any questions?
Feel free to contact us. Find all contact information on our contact page.