Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
finalizing uhttpd role for release 0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
imp1sh committed Jan 18, 2023
1 parent ea21c74 commit 36c6dfa
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 41 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ansible-galaxy collection install imp1sh.ansible_openwrt
```

This is an Ansible collection for OpenWrt devices. It will only work if you have enough flash space available to install python which is required. Details can be found in the [documentation](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection).
It has been tested on virtualized x86 (kvm), PC Engines APU4, Edgerouter X and Deciso DEC740.
It has been tested on a considerate amount of different devices.
## Who is this for?
OpenWrt typically is being used in small environments but this collection is a game changer. You could run virtualized firewalls with this in cloud environments or as a hosting provider. This role is an alternative solution to what OpenWisp does. You can manage hundreds or thousands of devices centrally with Ansible.

Expand All @@ -27,6 +27,7 @@ Sections:
- [Ansible OpenWrt Service](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleServices)
- [Ansible OpenWrt System](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleSystem)
- [Ansible OpenWrt Tinyproxy](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleTinyproxy)
- [Ansible OpenWrt uhttpd](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleUhttpd)
- [Ansible OpenWrt Wireguard](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleWireguard)
- [Ansible OpenWrt Wireless](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleWireless)
- [Ansible OpenWrt Imagebuilder](https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection/roleImagebuilder)
4 changes: 2 additions & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
namespace: imp1sh
name: ansible_openwrt
version: 0.4.0
version: 0.4.3
readme: README.md
authors:
- Jochen Demmer <[email protected]>
description: ansible_openwrt is a full featured openwrt collection. It relies on python so you need enough disk space in order to be able to use it.
license_file: 'LICENSE'
tags: [openwrt, lede, dhcp, dnsmasq, dropbear, ssh, firewall, network, packages, restic, backup, services, system, wifi, wireless, wireguard, vpn, sqm, imagebuilder, wireguard]
tags: [openwrt, lede, dhcp, dnsmasq, dropbear, ssh, firewall, network, packages, restic, backup, services, system, wifi, wireless, wireguard, vpn, sqm, imagebuilder, wireguard, uhttpd, tinyproxy, imagebuilder]
dependencies: {}
repository: https://github.com/imp1sh/ansible_openwrt
documentation: https://wiki.junicast.de/en/junicast/docs/AnsibleOpenWrtCollection
Expand Down
39 changes: 1 addition & 38 deletions roles/ansible_openwrtuhttpd/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
Role Name
=========

A brief description of the role goes here.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
https://github.com/imp1sh/ansible_openwrt
4 changes: 4 additions & 0 deletions roles/ansible_openwrtuhttpd/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
openwrt_uhttpd_deployroot: "/"
openwrt_uhttpd_deploypath: "{{ openwrt_uhttpd_deployroot }}etc/config"
openwrt_uhttpd_deployfile: "uhttpd"
openwrt_uhttpd_cert_searchpath: "/etc/acme/{{ inventory_hostname }}"
openwrt_uhttpd_main_listen_http:
- "0.0.0.0:80"
- "[::]:80"
Expand Down
4 changes: 4 additions & 0 deletions roles/ansible_openwrtuhttpd/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
---
# handlers file for ansible_uhttpd
- name: restart uhttpd
ansible.builtin.service:
name: uhttpd
state: restarted
29 changes: 29 additions & 0 deletions roles/ansible_openwrtuhttpd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
---
# tasks file for ansible_uhttpd
- name: Make sure deploypath is present
ansible.builtin.file:
path: "{{ openwrt_uhttpd_deploypath }}"
state: directory
- name: search for existing certificate
ansible.builtin.stat:
path: "{{ openwrt_uhttpd_cert_searchpath }}/{{ inventory_hostname }}.cer"
register: searchcert
- name: search for existing key
ansible.builtin.stat:
path: "{{ openwrt_uhttpd_cert_searchpath }}/{{ inventory_hostname }}.key"
register: searchkey
- name: debug
debug:
msg: "{{ searchcert }}"
- name: overwrite defaults with found cert and key
ansible.builtin.set_fact:
openwrt_uhttpd_main_cert: "{{ searchcert.stat.path }}"
openwrt_uhttpd_main_key: "{{ searchkey.stat.path }}"
when:
- searchkey is defined
- searchcert is defined
- searchkey.stat.exists
- searchcert.stat.exists
- name: Deploy uhttpd config
ansible.builtin.template:
src: "uhttpd.jinja2"
dest: "{{ openwrt_uhttpd_deploypath }}/{{ openwrt_uhttpd_deployfile }}"
notify: restart uhttpd

0 comments on commit 36c6dfa

Please sign in to comment.