diff --git a/defaults/main.yml b/defaults/main.yml index 6567ca5..595b085 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -35,6 +35,18 @@ checksum_to_platform_version: platform: eos build_version: 4.23.0F src_image_format: vmdk + 80f16ecb165b49529c90d2e8855a91d0e03e9429: + platform: eos + build_version: 4.22.11M + src_image_format: vmdk + ad456b76a00ad0170470654ef20e37bde0d87278: + platform: eos + build_version: 4.24.6M + src_image_format: vmdk + b95264d2271d29e50a08ba41749337b7ae3ffc20: + platform: eos + build_version: 4.26.1F + src_image_format: vmdk f6dc60eb343efae0ca0c1cb2a83a8eae030c9c8e: platform: vyos build_version: 1.1.8 diff --git a/tasks/build_image.yaml b/tasks/build_image.yaml index 1082ee1..15b783b 100644 --- a/tasks/build_image.yaml +++ b/tasks/build_image.yaml @@ -35,9 +35,29 @@ enable_password: "{{ lookup('password', '/dev/null length=12') }}" when: enable_password is not defined + +- name: Zerotouch disable + include: "{{ platform }}/{{ build_version }}/disable_ztp.yaml" + +- name: Bootstrap VM if necessary again + include: "{{ item }}" + with_first_found: + - files: + - "{{ platform }}/{{ build_version }}/bootstrap.yaml" + skip: True + + +- name: Wait for VM SSH + wait_for: + port: 8022 + search_regex: SSH + - name: Configure VM include: "{{ platform }}/{{ build_version }}/configure.yaml" +- name: Remove ssh key + include: "{{ platform }}/{{ build_version }}/remove_ssh_key.yaml" + - name: Kill QEMU shell: killall qemu-system-x86_64 diff --git a/tasks/eos/4.24.6M/bootstrap.yaml b/tasks/eos/4.24.6M/bootstrap.yaml new file mode 100644 index 0000000..f70954a --- /dev/null +++ b/tasks/eos/4.24.6M/bootstrap.yaml @@ -0,0 +1,6 @@ +--- +- name: Bootstrap VM + expect: + command: telnet localhost 8888 + responses: "{{ expect_responses }}" + timeout: "{{ bootstrap_timeout }}" diff --git a/tasks/eos/4.24.6M/configure.yaml b/tasks/eos/4.24.6M/configure.yaml new file mode 100644 index 0000000..0392464 --- /dev/null +++ b/tasks/eos/4.24.6M/configure.yaml @@ -0,0 +1,22 @@ +--- +- name: reset the connection + meta: reset_connection + +- name: Wait for image boot up + pause: + seconds: 300 + +- arista.eos.eos_config: + src: "{{ image_config_path | default (platform + '/' + build_version + '/config.j2') }}" + save_when: always + become: true + vars: + ansible_user: admin + ansible_ssh_pass: admin + ansible_port: 8022 + ansible_network_os: eos + ansible_host_key_checking: false + ansible_become: true + ansible_become_method: enable + ansible_become_pass: admin + ansible_connection: ansible.netcommon.network_cli diff --git a/tasks/eos/4.24.6M/disable_ztp.yaml b/tasks/eos/4.24.6M/disable_ztp.yaml new file mode 100644 index 0000000..2df198b --- /dev/null +++ b/tasks/eos/4.24.6M/disable_ztp.yaml @@ -0,0 +1,18 @@ +--- +- arista.eos.eos_command: + commands: + - zerotouch disable + become: true + vars: + ansible_user: admin + ansible_password: admin + ansible_port: 8022 + ansible_network_os: eos + ansible_host_key_checking: false + ansible_become: true + ansible_become_method: enable + ansible_become_pass: admin + ansible_connection: ansible.netcommon.network_cli +- name: Wait for the network device to reload + wait_for_connection: + delay: 100 diff --git a/tasks/eos/4.24.6M/remove_ssh_key.yaml b/tasks/eos/4.24.6M/remove_ssh_key.yaml new file mode 100644 index 0000000..39ed046 --- /dev/null +++ b/tasks/eos/4.24.6M/remove_ssh_key.yaml @@ -0,0 +1,15 @@ +--- +- arista.eos.eos_config: + src: "{{ image_config_path | default (platform + '/' + build_version + '/rm_key.j2') }}" + save_when: always + become: true + vars: + ansible_user: admin + ansible_ssh_pass: admin + ansible_port: 8022 + ansible_network_os: eos + ansible_host_key_checking: false + ansible_become: true + ansible_become_method: enable + ansible_become_pass: admin + ansible_connection: ansible.netcommon.network_cli diff --git a/templates/eos/4.24.6M/config.j2 b/templates/eos/4.24.6M/config.j2 new file mode 100644 index 0000000..c6a3f9c --- /dev/null +++ b/templates/eos/4.24.6M/config.j2 @@ -0,0 +1,23 @@ +no username admin +hostname {{ hostname }} +dns domain {{ domain_name }} +ip name-server 1.1.1.1 + +username {{ admin_user }} secret {{ admin_user_password }} privilege 15 +username {{ regular_user }} secret {{ regular_user_password }} privilege 1 +username zuul privilege 15 nopassword + +username zuul ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDI3XA0A84nUpCr9mfkrDjBdoNFtYMXqXMm2+WsGrOJUA2ESodUDDfTKmsA/xEygdCnj8JfSC3SYhc0uKHVe0RdG20mzntUqD50kB0STFeOHh3ee7FXmMxcLqLlyY9pJkn1V5WOi/D1Lbz8MwRUVBfqufryavwHla/9CPuAtPcut8mTUB0+Rapnv8W3n4dA6PqHNW1tylJUXj6P4trJPnFrdfMaIxc21tfd/QrMM4h90phW3zNILE0qF9UHpQxP0zew/LcD9rc+IhnbgC3DeCQDyiqJOsJRDo58RuwWmQHCF0SfiFQJ4qwrc6TFSJqSdi2aRY0S/vRMbXkD+6Hg2KWQyz6Z6EpY7RARletqJwNnzuuhXr2HSCj5QALe+0U/aUEX+dnydYBX6Nqa+0Rz/qV5aUk4YP1C2/dBCAdbYXPotBT6QBfekE428mJV8Mr7G/M7kwZ8v9WjytyJ8/FYNuekYDWonk6QTwDgQhMTiQI3Yxnu3ID63BL959lfUIv96bsifVI6/D36KTAdFi/dl7Omn5MZ9A5JXA7l+yEJKf4pcPTpQcPbjGSKyaPu0uffEjV9CTr3+VMwzq1uenxGDQ9cT/ud4pEEjwU/ihr6yttouTCvDu9ydrflHljUXxf+X00NW7HkrHnvS43AGnxQzi9g2lTOC9yDlDGbQjmnVjec7w== zuul-executor + +username zuul ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgOp/WpwK0HBfgJoYDXo+yZbLqkNrbkbtk3p6MxJumQlXxXhKWY0uJXbrecjhJG6Ydv/6SzKQeoVWSPJUkZ0xD1l7KCPN+iNJyRQGwiyIi/Vd7JNt0pn+dblmPA5GzAwEMcT+49OlK0I1p1JwpSa0CFgNH8zSZOqCaH8yUiKtbc0UtCdQehSIcHvz573E2IbeDMG1omijf6fAT67tEAzEbsasCN/bSmXDraAQ+XIPPsFoifCQaSOL3SsyjG0awNfTotiBW68DqzR29KYwMQntM1ACVWPMda2rVTUFmV51ono/Ux2vRiV8zMCQAzZdy9gkF+3bDnK7VeY2rccp7EaVj root@managesf + +interface Management 1 +ip address dhcp +dhcp client accept default-route + +management ssh + hostkey server rsa + +ip routing + +copy running-config startup-config diff --git a/templates/eos/4.24.6M/inventory.j2 b/templates/eos/4.24.6M/inventory.j2 new file mode 100644 index 0000000..4585778 --- /dev/null +++ b/templates/eos/4.24.6M/inventory.j2 @@ -0,0 +1,14 @@ +[eos] +{{ hostname }}.{{ domain_name }} + +[eos:vars] +ansible_network_os=eos +ansible_connection=local +ansible_host=localhost +ansible_port=8022 +ansible_user={{ admin_user }} +ansible_ssh_pass={{ admin_user_password }} +ansible_become=true +ansible_become_method=enable +ansible_become_pass={{ admin_user_password }} +ansible_connection=ansible.netcommon.network_cli diff --git a/templates/eos/4.24.6M/qemu.j2 b/templates/eos/4.24.6M/qemu.j2 new file mode 100644 index 0000000..e9ba6eb --- /dev/null +++ b/templates/eos/4.24.6M/qemu.j2 @@ -0,0 +1,3 @@ +#!/bin/bash + +/usr/bin/qemu-system-x86_64 -nographic -m 6144 -smp 2 -enable-kvm -serial telnet:localhost:8888,server,nowait -monitor telnet:localhost:8889,server,nowait -netdev user,id=net0,hostfwd=tcp::8022-:22 -device e1000,netdev=net0 -netdev user,id=net1 -device e1000,netdev=net1 -netdev user,id=net2 -device e1000,netdev=net2 -drive file={{ image_name }}.qcow2,if=ide & diff --git a/templates/eos/4.24.6M/rm_key.j2 b/templates/eos/4.24.6M/rm_key.j2 new file mode 100644 index 0000000..de1d7f3 --- /dev/null +++ b/templates/eos/4.24.6M/rm_key.j2 @@ -0,0 +1,3 @@ +bash +rm -f /persist/secure/ssh_* +exit diff --git a/vars/eos/4.24.6M/vars.yml b/vars/eos/4.24.6M/vars.yml new file mode 100644 index 0000000..df730b3 --- /dev/null +++ b/vars/eos/4.24.6M/vars.yml @@ -0,0 +1,18 @@ +--- +expect_responses: + 'localhost login: ': 'admin' + 'localhost>': enable + 'localhost#': + - config + - bash + - copy running-config startup-config + - "\x1d" + 'localhost\(config\)#': + - username admin secret admin + - exit + '\[admin@localhost ~\]\$ ': + - sudo dhclient ma1 + - exit + 'telnet>': quit + +qemu_command: "/usr/bin/qemu-system-x86_64 -nographic -m 2G -smp 2 -enable-kvm -serial telnet:localhost:8888,server,nowait -monitor telnet:localhost:8889,server,nowait -netdev user,id=net0,hostfwd=tcp::8022-:22 -device e1000,netdev=net0 -netdev user,id=net1 -device e1000,netdev=net1 -netdev user,id=net2 -device e1000,netdev=net2 -drive file=cloned_image,if=ide"