From 0c94b5e9a5bca4f01621be7b0792c16adb7b15f2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 8 Jun 2019 05:27:36 +0200 Subject: initial support for dellos6 switches --- roles/dellos6/bootstrap/tasks/main.yml | 14 ++++++++++++++ roles/dellos6/bootstrap/templates/init.j2 | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 roles/dellos6/bootstrap/tasks/main.yml create mode 100644 roles/dellos6/bootstrap/templates/init.j2 (limited to 'roles/dellos6/bootstrap') diff --git a/roles/dellos6/bootstrap/tasks/main.yml b/roles/dellos6/bootstrap/tasks/main.yml new file mode 100644 index 00000000..552aeddd --- /dev/null +++ b/roles/dellos6/bootstrap/tasks/main.yml @@ -0,0 +1,14 @@ +--- +- name: generate initial configuration + delegate_to: localhost + pause: + prompt: "\n## Please apply the following configuration using the serial console!!!\n\n{{ lookup('template', 'init.j2') }}\n\n## end .. press enter to continue!!!!!\n" + +- name: get config facts from the switch + dellos6_facts: + gather_subset: + - hardware + register: switch_facts + +- debug: + var: switch_facts diff --git a/roles/dellos6/bootstrap/templates/init.j2 b/roles/dellos6/bootstrap/templates/init.j2 new file mode 100644 index 00000000..2435c738 --- /dev/null +++ b/roles/dellos6/bootstrap/templates/init.j2 @@ -0,0 +1,27 @@ +enable +configure + +no ip domain-lookup +hostname {{ host_name }} +{# TODO: hardcoded address and vlan tag! #} +interface vlan 1 +ip address 192.168.42.200 255.255.255.0 +exit +no spanning-tree + +crypto key generate rsa +crypto key generate dsa +ip ssh server +ip ssh pubkey-auth + +username "root" password {{ ansible_become_password }} privilege 15 +{% for ssh_key in ssh_keys_root %} +crypto key pubkey-chain ssh user-key "root" rsa +key-string row "{{ ssh_key }}" +exit +{% endfor %} + +enable password {{ ansible_become_password }} +end + +write -- cgit v1.2.3