Using Ansible with OpenWRT

I’ve recently been playing with OpenWRT, and decided to see if I could use Ansible to manage it.  From a basic install of OpenWRT, here is what needs to be done to be able to manage with Ansible:

  • Use the WebUI to upload your SSH public key
  • Install a few packages, either via the WebUI or from the CLI with “opkg install”
    • python-light
    • python-logging
    • python-crypto
  • On your Ansible control node, specify the following in your ansible.cfg (dropbear does not include the sftp subsystem):
    [ssh_connection]
    scp_if_ssh = True
  • Give it a test (output trimmed below for brevity):
    $ ansible -msetup -i root@192.168.1.1, all
    root@192.168.1.1 | SUCCESS => {
    "ansible_facts": {
      ...
      "ansible_architecture": "mips",
      ...
      "ansible_distribution": "LEDE",
      "ansible_distribution_version": "17.01.4, Reboot",
      ...
      "ansible_os_family": "LEDE",
      "ansible_pkg_mgr": "opkg",
      ...
      }
    }

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s