{"id":20140704,"url":"https://github.com/goffinet/ansible-install-gns3-server","last_synced_at":"2025-04-09T18:40:46.736Z","repository":{"id":116033958,"uuid":"238386444","full_name":"goffinet/ansible-install-gns3-server","owner":"goffinet","description":"Ansible playbooks to provision, install, configure a GNS3 Server","archived":false,"fork":false,"pushed_at":"2020-02-05T17:18:06.000Z","size":62,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T20:37:23.300Z","etag":null,"topics":["ansible-playbook","ansible-roles","gns3","gns3-server"],"latest_commit_sha":null,"homepage":"https://cisco.goffinet.org/ccna/cisco-ios-cli/installer-et-configurer-gns3/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goffinet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-05T06:49:31.000Z","updated_at":"2024-07-09T22:44:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"9196c0df-532c-4ebf-a64d-5c6f10e63d78","html_url":"https://github.com/goffinet/ansible-install-gns3-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goffinet%2Fansible-install-gns3-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goffinet%2Fansible-install-gns3-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goffinet%2Fansible-install-gns3-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goffinet%2Fansible-install-gns3-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goffinet","download_url":"https://codeload.github.com/goffinet/ansible-install-gns3-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248089730,"owners_count":21045959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible-playbook","ansible-roles","gns3","gns3-server"],"created_at":"2024-11-13T21:53:14.999Z","updated_at":"2025-04-09T18:40:46.728Z","avatar_url":"https://github.com/goffinet.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Collection - Deploy GNS3 Server\n\n\n\nThis Ansible collection includes several roles to deploy GNS3 servers.\n\nThis code was tested with playbooks located in the `playbooks` folder. The Ansible Collection was not yet tested.\n\nI use it to provide infrastructure labs through GNS3 to people I meet in my training classes.\n\nUsualy, you can follow four steps to do it, as the four following playbooks :\n\n1. `playbooks/provision.yml` : Provision Scaleway C2 instances (cheapest) or Packet servers (premium).\n2. `playbooks/install-gns3-server.yml` : Install gns3-server stack with libvirtd/qemu/kvm, docker, fail2ban, openvpn, routing.\n3. `playbooks/synchronize-gns3-files.yml` : Synchronize S3 bucket with default GNS3 folders on servers (AWS S3 object storage).\n4. `playbooks/send-credits.yml` : Send credits to users. Everyone receives an email message telling him how to install an OpenVPN client, how to connect to the GNS3 server tunnel with the attached file, and how to install and configure the GNS3 client.\n\nYou can deploy or deprovision the solution in one step with those two playbooks :\n\n* `deploy.yml` : This playbook read the four playbooks above.\n* `deprovision.yml` : Deprovision (terminate) servers.\n\n## Software requirements\n\nInstall `pip` and `git` :\n\n- [How to install pip on Windows?](https://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows)\n- [How do I install pip on macOS or OS X?](https://stackoverflow.com/questions/17271319/how-do-i-install-pip-on-macos-or-os-x)\n- [Proper way to install pip on Ubuntu](https://stackoverflow.com/questions/37954008/proper-way-to-install-pip-on-ubuntu)\n\nDownload this repo :\n\n```bash\ngit clone https://github.com/goffinet/ansible-install-gns3-server\n\n```\n\nInstall requirements :\n\n```bash\ncd ansible-install-gns3-server\npip install -r requirements.txt\n```\n\n## Inventories\n\nYou will find some inventories inside the `playbooks/inventories` folder.\n\nMinimal (without any provision, sending mail and files synchronization) :\n\n```ini\n[gns3server]\ngns3server0 ansible_host=\"172.16.31.0\" mail_to=\"user0@domain.com\"\ngns3server1 ansible_host=\"172.16.31.1\" mail_to=\"user1@domain.com\"\n\n[all:vars]\nansible_ssh_user=root\nansible_ssh_pass=testtest\nansible_port=22\n\n```\n\nFull (with all features) :\n\n```ini\n[gns3server]\ngns3server0.mydomain.com mail_to=\"user0@domain.com\" provider=\"scw\" scw_type=\"C2S\"\ngns3server1.mydomain.com mail_to=\"user1@domain.com\" provider=\"packet\"\n\n[all:vars]\nzone=\"mydomain.com\"\nansible_ssh_user=root\nprovider=\"scw\" # packet\nscw_type=\"C2M\"\nscw_region=\"par1\"\nscw_image_name=\"Ubuntu Bionic Beaver\"\nscw_image_arch=\"x86_64\"\nscw_image_size=10000000000\npacket_facility=\"ams1\"\npacket_plan=\"t1.small.x86\"\npacket_os=\"ubuntu_18_04\"\npacket_project_id=\"88bd4dc8-8fe1-4130-8968-67147209365e\"\n\n```\n\n## Secret credits\n\nBut you must also set secret variables in a file `playbooks/vars/secret.yml` as it :\n\n```yaml\n---\n# Cloudflare DNS entries update\ncloudflare_account_email: \"mail@domain.com\"\ncloudflare_account_api_token: \"XXXXX\"\n# Scaleway ID\nscw_api_token: \"XXXXX\"\nscw_organization: \"XXXXX\"\n# Packet ID\npacket_auth_token: \"XXXXX\"\n# Google Mail ID\nmail_secret: \"secret_password\"\nfrom_secret: \"mail@domain.com\"\nto_secret: \"other_mail@domain.com\"\n# S3 files synchronization\nS3_URL: s3.fr-par.scw.cloud\nS3_REGION: FR-PAR\nS3_ACCESS_KEY: \"XXXXX\"\nS3_SECRET_KEY: \"XXXXX\"\n```\n\nIt is strongly recommended to encrypt this file :\n\n```bash\nansible-vault encrypt playbooks/vars/secret.yml\n```\n\n## Main parameters\n\nSome main parameters are defined in the `playbooks/vars/main.yml` variables file.\n\n```yaml\n---\n## General variables\n# EasyRSA variables\neasyrsa_generate_dh: true\neasyrsa_servers:\n  - name: server\neasyrsa_clients:\n  - name: client\neasyrsa_pki_dir: /etc/easyrsa/pki\n# OpenVPN variables\nopenvpn_use_pam: false\nopenvpn_client_to_client: false\nopenvpn_comp_lzo: false\nopenvpn_unified_client_profiles: true\nopenvpn_keydir: \"{{ easyrsa_pki_dir }}\"\nopenvpn_clients: \"{{ easyrsa_clients }}\"\nopenvpn_download_clients: true\nopenvpn_download_dir: /tmp/\nopenvpn_server: 172.16.253.0 255.255.255.0\nopenvpn_route_traffic: true\nopenvpn_route_ranges:\n  - 192.168.122.0 255.255.255.0\n# Docker variables\ndocker_users:\n  - gns3\n# GNS3-server variables\ngns3s_host: \"172.16.253.1\"\ngns3s_port: \"3080\"\ngns3s_home: /home/gns3/\n# Files synchronization\ngns3s_files:\n  - s3src: s3://labimages/gns3/images\n    s3dst: \"{{ gns3s_home }}\"\n  - s3src: s3://labimages/gns3/projects\n    s3dst: \"{{ gns3s_home }}\"\n#  - s3src: s3://labimages/gns3/appliances\n#    s3dst: /usr/share/gns3/gns3-server/lib/python3.6/site-packages/gns3server\neasyrsa_conf_req_country: FR\neasyrsa_conf_req_cn: \"{{ inventory_hostname }}\"\neasyrsa_conf_req_province: \"Paris\"\neasyrsa_conf_req_city: \"Paris\"\neasyrsa_conf_req_org: \"GNS3 labs\"\neasyrsa_conf_req_email: \"root@{{ inventory_hostname }}\"\neasyrsa_conf_req_ou: \"gns3labs\"\n\n```\n\n## Provision servers\n\n_If you already have a server on the hand, you can avoid the `playbooks/provision.yml` playbook._\n\nI use Cloudflare API with my domain to provide an easy name to remember for management. I you do not use a Cloudflare managed zone, please define the public IP address of your server in the `ansible_host` inventory variable.\n\nGNS3 is in constant development but we need a robust installation with dev or stable latest releases. The latest Ubuntu Bionic can use the GNS3 Release Team PPA repos. No need to support any virtualbox, vpcs or IOU in my scenarios. KVM and Docker are sufficient.\n\nYou can choose several [Scaleway servers](https://blog.scaleway.com/2016/c2-insanely-affordable-x64-servers/) `scw_type` :\n\n- \"C2S\"\n- \"C2M\"\n- \"C2L\"\n- \"DEV1-S\" (only for my own convenience)\n\nNote: [Scaleway offers also \"premium\" bare metal category](https://www.scaleway.com/fr/serveurs-bare-metal/). The provision function should be supported by a tool such as Terraform and integrated with Ansible configuration management. Terraform can be more \"agile\" for multi-vendors servers.\n\nOr you can choose [Packet servers](https://www.packet.com/cloud/servers/) `packet_type` :\n\n- \"t1.small.x86\" (default)\n- \"c1.small.x86\"\n- \"t3.small.x86\"\n- \"c3.small.x86\"\n\nOr you can choose any baremetal service provider, any real server or virtual machine (with nested virtualization) with a minimal Ubuntu Bionic (18.04) installation to use the following playbooks.\n\n## Install GNS3 server\n\nRoles embedded in the `playbooks/install-gns3-server.yml` playbook :\n\n- \"create a ca\" (nkakouros.easyrsa)\n- \"install openvpn\" (Stouts.openvpn)\n- \"install libvirtd\" (install-libvirtd)\n- \"install docker-engine\" (geerlingguy.docker)\n- \"install gns3-server\" (install-gns3-server)\n- \"install fail2ban\" (install-fail2ban)\n- \"enable routing\" (enable-routing)\n\n## Synchronize files\n\nThe `playbooks/synchronize-gns3-files.yml` synchronize several S3 bucket folder to the destination server. I use thoses variables to transfer my images and my projects to the servers (`playbooks/vars/main.yml`) :\n\n```yaml\ngns3s_files:\n  - s3src: s3://labimages/gns3/images\n    s3dst: \"{{ gns3s_home }}\"\n  - s3src: s3://labimages/gns3/projects\n    s3dst: \"{{ gns3s_home }}\"\n```\n\nDo not forget to fix and to protect the S3 credits  :\n\n```yaml\n# S3 files synchronization\nS3_URL: s3.fr-par.scw.cloud\nS3_REGION: FR-PAR\nS3_ACCESS_KEY: \"XXXXX\"\nS3_SECRET_KEY: \"XXXXX\"\n```\n\n## Send credits\n\nThe `playbooks/send-credits.yml` playbook send a custom message in french or in english with the OpenVPN connexion file and the process to install and configure an Openvpn client and the GNS3 client software.\n\nDo not forget to fix and to protect the mail credits :\n\n```yaml\n# Google Mail ID\nmail_secret: \"secret_password\"\nfrom_secret: \"mail@domain.com\"\nto_secret: \"other_mail@domain.com\"\n```\n\n## Ansible configuration\n\n```ini\n[defaults]\ninventory = ./inventories/hosts\n#inventory=./inventories/scaleway_inventory.yml\nprivate_key_file = ~/.ssh/id_rsa\nforks = 16\n#strategy = free\ngathering = explicit\nbecome = True\nhost_key_checking = False\nssh_args = -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\nlog_path = ./ansible.log\nenable_plugins = host_list, script, yaml, ini, auto\nvault_password_file = ~/.vault_passwords.txt\n#display_ok_hosts = no\n#display_skipped_hosts = no\ncallback_whitelist = profile_tasks\n#[callback_profile_tasks]\n#task_output_limit = 100\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoffinet%2Fansible-install-gns3-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoffinet%2Fansible-install-gns3-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoffinet%2Fansible-install-gns3-server/lists"}