Add GNS3 support and fix typo in site.yml
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
[defaults]
|
||||
library = ../../plugins/modules
|
||||
roles_path = ../../roles
|
||||
nocows = 1
|
||||
retry_files_enabled = False
|
||||
display_skipped_hosts = no
|
||||
@@ -0,0 +1,22 @@
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Play with a dummy file to node
|
||||
gns3_node_file:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
node_name: alpine-1
|
||||
state: present
|
||||
dest: /etc/network/dummy_file
|
||||
data: |
|
||||
# Some data to insert on the file
|
||||
auto eth0
|
||||
iface eth0 inect dhcp
|
||||
|
||||
- name: Play with a dummy file on project
|
||||
gns3_project_file:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
state: present
|
||||
dest: README.txt
|
||||
data: |
|
||||
Hello! this is a README
|
||||
@@ -0,0 +1,16 @@
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Play with a dummy file to node
|
||||
gns3_node_file:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
node_name: alpine-1
|
||||
state: absent
|
||||
dest: /etc/network/dummy_file
|
||||
|
||||
- name: Play with a dummy file on project
|
||||
gns3_project_file:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
state: absent
|
||||
dest: README.txt
|
||||
@@ -0,0 +1,18 @@
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Retrieve computes info all
|
||||
gns3_facts:
|
||||
url: "{{ gns3_url }}"
|
||||
get_images: iou
|
||||
get_compute_ports: no
|
||||
register: resultado
|
||||
|
||||
- debug: var=resultado
|
||||
|
||||
# - name: Retrieves basic facts
|
||||
# gns3_facts:
|
||||
# url: "{{ gns3_url }}"
|
||||
# register: resultado
|
||||
|
||||
# - debug: var=resultado
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
gns3_url: "http://dev_gns3server"
|
||||
gns3_project_name: test_ansible
|
||||
gns3_nodes_spec:
|
||||
- name: veos-1
|
||||
template: "vEOS-4.21.5F"
|
||||
- name: veos-2
|
||||
template: "vEOS-4.21.5F"
|
||||
- name: ios-1
|
||||
template: "IOU-L2-15.1"
|
||||
- name: ios-2
|
||||
template: "IOU-L3-15.4"
|
||||
- name: alpine-1
|
||||
template: "alpine"
|
||||
gns3_nodes_strategy: one_by_one
|
||||
gns3_links_spec:
|
||||
- ["veos-1", "Ethernet1", "veos-2", "Ethernet1"]
|
||||
- ["veos-1", "Ethernet2", "ios-1", "Ethernet1/0"]
|
||||
- ["veos-2", "Ethernet2", "ios-2", "Ethernet1/0"]
|
||||
- ["ios-1", "Ethernet1/2", "ios-2", "Ethernet1/2"]
|
||||
- ["ios-1", "Ethernet1/3", "alpine-1", "eth0"]
|
||||
@@ -0,0 +1,28 @@
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Get server version
|
||||
gns3_facts:
|
||||
url: "{{ gns3_url }}"
|
||||
get_images: all
|
||||
get_compute_ports: yes
|
||||
register: resultado
|
||||
|
||||
- debug: var=resultado
|
||||
|
||||
- name: Creation/Active section
|
||||
when: execute == "create"
|
||||
block:
|
||||
- import_role:
|
||||
name: create_lab
|
||||
|
||||
- name: Get nodes inventory
|
||||
gns3_nodes_inventory:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
register: nodes_inventory
|
||||
|
||||
- debug: var=nodes_inventory
|
||||
|
||||
- import_role:
|
||||
name: delete_lab
|
||||
when: execute == "delete"
|
||||
@@ -0,0 +1,28 @@
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Reload a node alpine node which requires a special reload
|
||||
gns3_node:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
node_name: alpine-1
|
||||
state: reload
|
||||
retry: yes
|
||||
poll_wait_time: 30
|
||||
|
||||
- name: Stop ios-1
|
||||
gns3_node:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
node_name: ios-1
|
||||
state: stopped
|
||||
|
||||
- name: Start ios-1
|
||||
gns3_node:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
node_name: ios-1
|
||||
state: started
|
||||
register: node
|
||||
|
||||
- debug: var=node
|
||||
@@ -0,0 +1,39 @@
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Stop nodes on the project
|
||||
gns3_project:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
state: opened
|
||||
nodes_state: stopped
|
||||
|
||||
- name: Create snapshot
|
||||
gns3_snapshot:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
snapshot_name: snap
|
||||
state: present
|
||||
register: resultado
|
||||
|
||||
- debug: var=resultado
|
||||
|
||||
- pause:
|
||||
minutes: 1
|
||||
|
||||
- name: Restore snapshot
|
||||
gns3_snapshot:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
snapshot_name: snap
|
||||
state: restore
|
||||
|
||||
- pause:
|
||||
minutes: 1
|
||||
|
||||
- name: Delete snapshot
|
||||
gns3_snapshot:
|
||||
url: "{{ gns3_url }}"
|
||||
project_name: "{{ gns3_project_name }}"
|
||||
snapshot_name: snap
|
||||
state: absent
|
||||
Reference in New Issue
Block a user