Skip to content

An ansible role to build and flash OpenWrt images

License

Notifications You must be signed in to change notification settings

revboot/revboot.openwrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revboot Ansible :: OpenWrt role

Builds OpenWrt firmware images with the OpenWrt Image Builder.

Optionally, can also flash firmware images to compatible devices.

Requirements

Does not require root privileges.

Requires system dependencies to build the images.

To install dependencies in Debian and Ubuntu systems:

sudo apt install -y \
  unzip wget rsync git python gawk gettext \
  build-essential zlib1g-dev libssl1.0-dev \
  libncurses5-dev libncursesw5-dev xsltproc

See Prerequisites for more information or how to install in other systems.

Role Actions

Actions control which task(s) are run to achievde a result.

They can be set using openwrt_action variable.

Supported actions:

  • download, to download image builder (for a target, sub-target and release combination)
  • clean, to delete firmware images and build files (for a target, sub-target and release combination)
  • build, to build a firmware image for a device
  • flash-sysupgrade, to flash a firmware image to a device using sysupgrade
  • reset-soft, to soft reset a device using firstboot
  • reset-hard, to hard reset a device using jffs2reset

Role Variables

See defaults/main.yml for information.

Dependencies

Has no Ansible Galaxy dependencies.

Example Playbook

To build firmware images:

    - name: "OpenWrt :: Build firmware image"
      hosts: openwrt_devices
      gather_facts: no
      tasks:
        - include_role:
            name: revboot.openwrt
          vars:
            openwrt_action:
              - "download"
              - "build"

To delete firmware images and build files:

    - name: "OpenWrt :: Delete firmware image and build files"
      hosts: openwrt_devices
      gather_facts: no
      tasks:
        - include_role:
            name: revboot.openwrt
          vars:
            openwrt_action:
              - "clean"

To flash firmware images with the OpenWrt Sysupgrade:

    - name: "OpenWrt :: Flash firmware image (Sysupgrade)"
      hosts: openwrt_devices
      gather_facts: no
      tasks:
        - include_role:
            name: revboot.openwrt
          vars:
            openwrt_action:
              - "flash-sysupgrade"

NOTE: The sysupgrade image flash method will only work on devices previously flashed with OpenWrt using a *squashfs-factory.bin file.

To soft-reset devices:

    - name: "OpenWrt :: Soft-reset device"
      hosts: openwrt_devices
      gather_facts: no
      tasks:
        - include_role:
            name: revboot.openwrt
          vars:
            openwrt_action:
              - "reset-soft"

To hard-reset devices:

    - name: "OpenWrt :: Hard-reset device"
      hosts: openwrt_devices
      gather_facts: no
      tasks:
        - include_role:
            name: revboot.openwrt
          vars:
            openwrt_action:
              - "reset-hard"

More Information

For more information, see the OpenWrt project resources:

Building OpenWrt and firmware images:

License

Revboot Ansible :: OpenWrt role

Copyright (C) 2021 Revboot - Tecnologias de Informação e Comunicação, Unipessoal Lda.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author Information

Created and maintained by Luís Pedro Algarvio.

Releases

No releases published

Packages

No packages published