{"id":48181422,"url":"https://github.com/davidban77/ansible-collection-gns3","last_synced_at":"2026-04-04T17:45:17.132Z","repository":{"id":40239514,"uuid":"204793714","full_name":"davidban77/ansible-collection-gns3","owner":"davidban77","description":"Ansible Collection for GNS3 Server REST API using gns3fy","archived":false,"fork":false,"pushed_at":"2022-05-18T17:38:09.000Z","size":70,"stargazers_count":31,"open_issues_count":5,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-03-02T22:37:37.266Z","etag":null,"topics":["ansible","gns3","gns3-api","gns3-server","netdevops","playbook"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/davidban77/gns3","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidban77.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-27T21:29:29.000Z","updated_at":"2023-03-02T22:37:37.266Z","dependencies_parsed_at":"2022-07-24T17:47:05.015Z","dependency_job_id":null,"html_url":"https://github.com/davidban77/ansible-collection-gns3","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/davidban77/ansible-collection-gns3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidban77%2Fansible-collection-gns3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidban77%2Fansible-collection-gns3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidban77%2Fansible-collection-gns3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidban77%2Fansible-collection-gns3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidban77","download_url":"https://codeload.github.com/davidban77/ansible-collection-gns3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidban77%2Fansible-collection-gns3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31407651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","gns3","gns3-api","gns3-server","netdevops","playbook"],"created_at":"2026-04-04T17:45:13.078Z","updated_at":"2026-04-04T17:45:17.125Z","avatar_url":"https://github.com/davidban77.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Module for GNS3\n[Ansible-Galaxy collections](https://galaxy.ansible.com/davidban77/gns3) repository for GNS3 Server REST API using [gns3fy - see the docs](https://davidban77.github.io/gns3fy/).\n\n## Installation\n\nFor the module to be used you need to have installed [gns3fy](https://github.com/davidban77/gns3fy)\n\n```\npip install gns3fy\n```\n\nThis collections is packaged under ansible-galaxy, so to install it you need [mazer from Ansible Projects](https://galaxy.ansible.com/docs/mazer/index.html):\n\n```\nmazer install davidban77.gns3\n```\n\n## Features\n\n- Open/closes projects.\n- Starts/stops all nodes inside a project, or it can be done sequentially with a delay factor.\n- Creates/Updates projects with nodes and links specified as variables in a playbook.\n- Deletes projects safely by stopping nodes, if there are any, then closing the project and finally deleting it.\n- Creates/Deletes/Restores snapshots of projects.\n- Retrieves information about available emulators on the GNS3 server compute, as well as available images, console ports, version, etc..\n- Idempotency is present in all actions. An example could be reflected in a playbook that creates a project with nodes and links, these settings will not be executed again on a rerun (and by settings I mean projects settings, nodes and links)/\n\n\n## Modules\n\nThese are the modules provided with this collection:\n\n- `gns3_version`: Retrieves GNS3 server version. (**TO BE DEPRECATED** with the `gns3_facts` module)\n- `gns3_facts`: Retrieves the compute(s) information of a GNS3 server\n- `gns3_project`: Module to interact with GNS3 server projects\n    - It opens/closes projects and performs basic turnup/teradown operations on nodes.\n    - It creates/updates or deletes projects, with the respective nodes and links specified\n- `gns3_project_file`: Updates/creates a file on a project directory.\n- `gns3_snapshot`: Module that interacts with snapshots of a project on GNS3 server.\n- `gns3_node`: Module to operate a node in a GNS3 server project.\n- `gns3_node_file`: Updates/creates a file on a node directory.\n- `gns3_nodes_inventory`: Retrieves GNS3 a project nodes console information.\n\n## Examples: using the module\n\nHere are some examples of how to use the module.\n\n#### Get server version\n\n```yaml\n---\n- host: localhost\n  # Call the collections to use the respective modules\n  collections:\n    - davidban77.gns3\n  vars:\n    gns3_url: http://localhost\n  tasks:\n    - name: Get the server facts\n      gns3_facts:\n        url: \"{{ gns3_url }}\"\n        port: 3080\n        get_images: all\n        get_compute_ports: yes\n      register: result\n\n    - debug: var=result\n```\n#### Get nodes_inventory information from a project\n\n```yaml\n---\n- host: localhost\n  # Call the collections to use the respective modules\n  collections:\n    - davidban77.gns3\n  vars:\n    gns3_url: http://localhost\n  tasks:\n    - name: Get the server version\n      gns3_nodes_inventory:\n        url: \"{{ gns3_url }}\"\n        project_name: lab_example\n      register: result\n\n    - debug: var=result\n```\n\n#### Manipulate GNS3 projects\n\n```yaml\n---\n# Open a GNS3 project\n- name: Start lab\n  gns3_project:\n    url: \"{{ gns3_url }}\"\n    state: opened\n    project_name: lab_example\n\n# Stop all nodes inside an open project\n- name: Stop nodes\n  gns3_project:\n    url: \"{{ gns3_url }}\"\n    state: opened\n    project_name: lab_example\n    nodes_state: stopped\n    nodes_strategy: all\n    poll_wait_time: 5\n\n# Open a GNS3 project and start nodes one by one with a delay of 10sec between them\n- name: Start nodes one by one\n  gns3_project:\n    url: \"{{ gns3_url }}\"\n    state: opened\n    project_name: lab_example\n    nodes_state: started\n    nodes_strategy: one_by_one\n    nodes_delay: 10\n\n# Close a GNS3 project\n- name: Stop lab\n  gns3_project:\n    url: \"{{ gns3_url }}\"\n    state: closed\n    project_id: \"UUID-SOMETHING-1234567\"\n```\n\n#### Create and delete projects\n\n```yaml\n---\n# Create a GNS3 project given nodes and links specifications\n- name: Create a project\n  gns3_project:\n    url: \"{{ gns3_url }}\"\n    state: present\n    project_name: new_lab\n    nodes_spec:\n        - name: alpine-1\n          template: alpine\n        - name: alpine-2\n          template: alpine\n    links_spec:\n        - ['alpine-1', 'eth0', 'alpine-2', 'eth1']\n\n# Delete a GNS3 project\n- name: Delete project\n  gns3_project:\n    url: \"{{ gns3_url }}\"\n    state: absent\n    project_name: new_lab\n```\n\n## Examples: using the roles\n\nThere are also some convinient roles that you can use to manage your labs. Here is an example playbook:\n\n`main.yml`\n```yaml\n- hosts: localhost\n  tasks:\n    - import_role:\n        name: create_lab\n      when: execute == \"create\"\n    - import_role:\n        name: delete_lab\n      when: execute == \"delete\"\n```\n\nThis way you can call and switch the behaviour of the playbook:\n\n**Create the lab**\n```\nansible-playbook main.yml -e execute=create\n```\n\nOr **delete the lab**\n```\nansible-playbook main.yml -e execute=delete\n```\n\nHere is the example variable file which specifies the naming convention used. You can see that the variable names come from the module itself with only `gns3_`\n\n```yaml\n---\ngns3_url: \"http://dev_gns3server\"\ngns3_project_name: test_ansible\ngns3_nodes_spec:\n    - name: veos-1\n      template: \"vEOS-4.21.5F\"\n    - name: veos-2\n      template: \"vEOS-4.21.5F\"\n    - name: ios-1\n      template: \"IOU-15.4\"\n    - name: ios-2\n      template: \"IOU-15.4\"\ngns3_nodes_strategy: one_by_one\ngns3_links_spec:\n    - [\"veos-1\", \"Ethernet1\", \"veos-2\", \"Ethernet1\"]\n    - [\"veos-1\", \"Ethernet2\", \"ios-1\", \"Ethernet1/0\"]\n    - [\"veos-2\", \"Ethernet2\", \"ios-2\", \"Ethernet1/0\"]\n    - [\"ios-1\", \"Ethernet1/2\", \"ios-2\", \"Ethernet1/2\"]\n```\n\n### More examples\n\nFor more examples like create an `/etc/network/interfaces` file for an `alpine` docker node to configure its network interfaces, or restore a project to an specific snapshot, you can go to the `test/playbooks` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidban77%2Fansible-collection-gns3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidban77%2Fansible-collection-gns3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidban77%2Fansible-collection-gns3/lists"}