This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new role ansible_openwrtimagebuilder, not finished
some more work to be done
- Loading branch information
Jochen Demmer
committed
Aug 21, 2022
1 parent
de18881
commit deb26bf
Showing
8 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/imp1sh/ansible_openwrt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# defaults file for ansible_openwrtimagebuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for ansible_openwrtimagebuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
galaxy_info: | ||
author: your name | ||
description: your role description | ||
company: your company (optional) | ||
|
||
# If the issue tracker for your role is not on github, uncomment the | ||
# next line and provide a value | ||
# issue_tracker_url: http://example.com/issue/tracker | ||
|
||
# Choose a valid license ID from https://spdx.org - some suggested licenses: | ||
# - BSD-3-Clause (default) | ||
# - MIT | ||
# - GPL-2.0-or-later | ||
# - GPL-3.0-only | ||
# - Apache-2.0 | ||
# - CC-BY-4.0 | ||
license: license (GPL-2.0-or-later, MIT, etc) | ||
|
||
min_ansible_version: 2.1 | ||
|
||
# If this a Container Enabled role, provide the minimum Ansible Container version. | ||
# min_ansible_container_version: | ||
|
||
# | ||
# Provide a list of supported platforms, and for each platform a list of versions. | ||
# If you don't wish to enumerate all versions for a particular platform, use 'all'. | ||
# To view available platforms and versions (or releases), visit: | ||
# https://galaxy.ansible.com/api/v1/platforms/ | ||
# | ||
# platforms: | ||
# - name: Fedora | ||
# versions: | ||
# - all | ||
# - 25 | ||
# - name: SomePlatform | ||
# versions: | ||
# - all | ||
# - 1.0 | ||
# - 7 | ||
# - 99.99 | ||
|
||
galaxy_tags: [] | ||
# List tags for your role here, one per line. A tag is a keyword that describes | ||
# and categorizes the role. Users find roles by searching for tags. Be sure to | ||
# remove the '[]' above, if you add tags to this list. | ||
# | ||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters. | ||
# Maximum 20 tags per role. | ||
|
||
dependencies: [] | ||
# List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
# if you add dependencies to this list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
# tasks file for ansible_openwrtimagebuilder | ||
- name: make sure builddir exists | ||
ansible.builtin.file: | ||
path: "{{ openwrt_imagebuilder_builddir }}" | ||
state: directory | ||
- name: make sure outputdir exists | ||
ansible.builtin.file: | ||
path: "{{ openwrt_imagebuilder_outputdir }}" | ||
state: directory | ||
- name: download and extract imagebuilder | ||
ansible.builtin.unarchive: | ||
src: "{{ openwrt_imagebuilder_downloadurl }}" | ||
list_files: yes | ||
remote_src: yes | ||
dest: "{{ openwrt_imagebuilder_builddir }}" | ||
register: openwrt_imagebuilder_extraction | ||
- name: get extracted folder name | ||
set_fact: | ||
openwrt_imagebuilder_extractedfolder: "{{ openwrt_imagebuilder_extraction.files[0] }}" | ||
- name: remove old files dir if exist | ||
ansible.builtin.file: | ||
path: "{{ openwrt_imagebuilder_builddir }}/{{ openwrt_imagebuilder_extractedfolder }}{{ openwrt_imagebuilder_filesdir }}" | ||
state: absent | ||
- name: create empty files dir | ||
ansible.builtin.file: | ||
path: "{{ openwrt_imagebuilder_builddir }}/{{ openwrt_imagebuilder_extractedfolder }}{{ openwrt_imagebuilder_filesdir }}" | ||
state: directory | ||
- name: set this files directory to use as openwrt deployroot for all compatible roles | ||
set_fact: | ||
"{{ item }}": "{{ openwrt_imagebuilder_builddir }}/{{ openwrt_imagebuilder_extractedfolder }}{{ openwrt_imagebuilder_filesdir }}/" | ||
loop: | ||
- openwrt_acme_deployroot | ||
- openwrt_batmanadv_deployroot | ||
- openwrt_babeld_deployroot | ||
- openwrt_bmx7_deployroot | ||
- openwrt_dhcp_deployroot | ||
- openwrt_dropbear_deployroot | ||
- openwrt_firewall_deployroot | ||
- openwrt_network_deployroot | ||
- openwrt_restic_deployroot | ||
- openwrt_services_deployroot | ||
- openwrt_system_deployroot | ||
- name: run all openwrt roles that are compatible with imagebuilder | ||
ansible.builtin.include_role: | ||
name: "{{ item }}" | ||
loop: | ||
- imp1sh.ansible_openwrt.ansible_openwrtacme | ||
- imp1sh.ansible_openwrt.ansible_openwrtbatmanadv | ||
- imp1sh.ansible_openwrt.ansible_openwrtbabeld | ||
- imp1sh.ansible_openwrt.ansible_openwrtdhcp | ||
- imp1sh.ansible_openwrt.ansible_openwrtdropbear | ||
- imp1sh.ansible_openwrt.ansible_openwrtfirewall | ||
- imp1sh.ansible_openwrt.ansible_openwrtnetwork | ||
- imp1sh.ansible_openwrt.ansible_openwrtrestic | ||
- imp1sh.ansible_openwrt.ansible_openwrtsystem | ||
#- imp1sh.ansible_openwrt.ansible_openwrtbmx7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localhost | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: localhost | ||
remote_user: root | ||
roles: | ||
- ansible_openwrtimagebuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# vars file for ansible_openwrtimagebuilder | ||
openwrt_imagebuilder_builddir: "/tmp/openwrt_imagebuilder" | ||
openwrt_imagebuilder_outputdir: "/tmp/openwrt_imagebuilder_images" | ||
openwrt_imagebuilder_downloadurl: "https://downloads.openwrt.org/releases/22.03.0-rc6/targets/x86/64/openwrt-imagebuilder-22.03.0-rc6-x86-64.Linux-x86_64.tar.xz" | ||
openwrt_imagebuilder_filesdir: "files" |