- k0s bootstrap with Cilium and OpenEBS - ArgoCD apps for infra, CAPI, Tinkerbell, and Netris - Ansible playbooks for virtual baremetal lab and Netris switches - CAPI provider manifests for k0smotron and Tinkerbell
60 lines
2.1 KiB
YAML
60 lines
2.1 KiB
YAML
---
|
|
# Configure a single Cumulus switch via SSH
|
|
|
|
- name: "{{ switch_name }} - Set hostname"
|
|
delegate_to: 127.0.0.1
|
|
shell: |
|
|
sshpass -p 'cumulus' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
|
-p {{ switch_ssh_port }} cumulus@127.0.0.1 \
|
|
"sudo hostnamectl set-hostname {{ switch_name }}"
|
|
register: result
|
|
retries: 3
|
|
delay: 10
|
|
until: result.rc == 0
|
|
|
|
- name: "{{ switch_name }} - Configure loopback IP"
|
|
delegate_to: 127.0.0.1
|
|
shell: |
|
|
sshpass -p 'cumulus' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
|
-p {{ switch_ssh_port }} cumulus@127.0.0.1 \
|
|
"sudo nv set interface lo ip address 10.0.0.{{ switch_id + 1 }}/32 && sudo nv config apply -y"
|
|
register: result
|
|
retries: 3
|
|
delay: 5
|
|
until: result.rc == 0
|
|
|
|
- name: "{{ switch_name }} - Enable LLDP"
|
|
delegate_to: 127.0.0.1
|
|
shell: |
|
|
sshpass -p 'cumulus' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
|
-p {{ switch_ssh_port }} cumulus@127.0.0.1 \
|
|
"sudo nv set service lldp && sudo nv config apply -y"
|
|
register: result
|
|
failed_when: false
|
|
|
|
- name: "{{ switch_name }} - Bring up all switch ports"
|
|
delegate_to: 127.0.0.1
|
|
shell: |
|
|
sshpass -p 'cumulus' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
|
-p {{ switch_ssh_port }} cumulus@127.0.0.1 \
|
|
"for i in \$(seq 1 48); do sudo nv set interface swp\$i link state up 2>/dev/null; done && sudo nv config apply -y"
|
|
register: result
|
|
failed_when: false
|
|
|
|
- name: "{{ switch_name }} - Configure BGP ASN"
|
|
delegate_to: 127.0.0.1
|
|
vars:
|
|
bgp_asn: "{{ 65000 + switch_id }}"
|
|
shell: |
|
|
sshpass -p 'cumulus' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
|
-p {{ switch_ssh_port }} cumulus@127.0.0.1 \
|
|
"sudo nv set router bgp autonomous-system {{ bgp_asn }} && \
|
|
sudo nv set router bgp router-id 10.0.0.{{ switch_id + 1 }} && \
|
|
sudo nv config apply -y"
|
|
register: result
|
|
failed_when: false
|
|
|
|
- name: "{{ switch_name }} - Configuration complete"
|
|
debug:
|
|
msg: "{{ switch_name }} configured with loopback 10.0.0.{{ switch_id + 1 }}/32, ASN {{ 65000 + switch_id }}"
|