Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting to collection #67

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Ansible Role: openwrt
=====================
Ansible Collection: gekmihesg.openwrt
=====================================

Manage OpenWRT and derivatives with Ansible but without Python.

Expand All @@ -26,18 +26,12 @@ Currently, the following modules have been implemented:
* uci (new)
* wait\_for\_connection (implicit)

# TODO: enable in play with ``collections: [gekmihesg.openwrt]``, reduce need for monkey patch
To achieve all this, some monkey patching is involved (in case you wonder about the `vars_plugins`).

Compatibility
-------------

This role was tested successfully with:
* LEDE 17.01 (manually)
* OpenWRT 18.06
* OpenWRT 19.07
* OpenWRT 21.02
* OpenWRT 22.03

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

Expand Down
14 changes: 14 additions & 0 deletions playbooks/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- hosts: openwrt
gather_facts: false
vars_prompt:
- name: openwrt_install_recommended_packages
default: true
- name: openwrt_wait_for_connection
default: true
- name: openwrt_wait_for_connection_timeout
default: 600
roles:
- prep
tasks:
- name: Ensure we have working setup by using custom fact gathering
gather_facts:
5 changes: 4 additions & 1 deletion defaults/main.yml → playbooks/group_vars/openwrt.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
openwrt_install_recommended_packages: true
# group_vars for openwrt group

openwrt_install_recommended_packages: true
openwrt_wait_for_connection: true
openwrt_wait_for_connection_timeout: 600

Expand All @@ -15,3 +16,5 @@ openwrt_ssh_use_tty: false
openwrt_remote_tmp: /tmp

openwrt_remote_opkg_lists_dir: /tmp/opkg-lists

ansible_facts_modules: gekmihesg.openwrt.setup
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
molecule[docker,lint]
docker
yamllint
ansible-lint
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tasks/packages.yml → roles/pkg/tasks/recommended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
changed_when: false
failed_when: false

- include_tasks: package.yml
- include_tasks: main.yml
with_dict:
base64: coreutils-base64
md5sum: coreutils-md5sum
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tasks/main.yml → roles/prep/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
tags: always

- name: install recommended packages
include_tasks: packages.yml
include_role:
name: pkg
tasks_from: recommended
when:
- "'openwrt' in group_names"
- "openwrt_install_recommended_packages | bool"