onie-nos-install from ansible

  • 1
  • Article
  • Updated 2 years ago

Wanted a way to re-install from ONIE without modifying DHCP options or manually runnning onie-nos-install. Played around with busybox’s ash shell until coming upon the -ilc invocation to get the path set for

Delegates the task to localhost so that the command can be performed with root, bypassing a non-root ansible_ssh_user in the inventory, which would otherwise take precedence.

Example playbook below.


- hosts: sw35
  become: yes

    initial_install: "http://webserver/CumulusLinux-2.5.1-"
      ppc: "powerpc"
      x86: "amd64"

  - name: boot into onie rescue mode
    command: "cl-img-select -fr"
    - restart machine
    - wait for switch to come back up
    tags: onie_rescue

  - name: reboot immediately
    meta: flush_handlers

  - name: onie-nos-install base version
    shell: ssh root@{{ inventory_hostname }} '/bin/ash -ilc "onie-nos-install {{initial_install}}{{ arch_map[ansible_architecture] }}.bin"'
    become: no
    tags: onie_nos_install
    - wait for switch to come back up

  - name: wait for switch to come back up
    meta: flush_handlers

  - name: restart machine
    command: shutdown -r now "Ansible updates triggered"
    async: 0
    poll: 0
    ignore_errors: true

  - name: wait for switch to come back up
    become: no
    local_action: wait_for host={{ inventory_hostname }} port=22 delay=20
    become: false
Photo of Trapier Marshall

Trapier Marshall, Alum

  • 230 Points 100 badge 2x thumb

Posted 2 years ago

  • 1

Be the first to post a reply!