Skip to content

Commit

Permalink
v 0.0.4 - added a role to create the bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
ji-podhead committed Aug 20, 2024
1 parent aec49f1 commit ec20af3
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 15 deletions.
20 changes: 9 additions & 11 deletions MANIFEST.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
{
"collection_info": {
"namespace": "ji_podhead",
"name": "host_prototypes",
"version": "0.0.5",
"name": "lil_bind",
"version": "0.0.0",
"authors": [
"ji-podhead (https://https://www.github.com/ji-podhead)"
],
"readme": "README.md",
"tags": [
"host_prototypes",
"random_cloud_init_config",
"random_mac_and_random_pass",
"random_ssh_keys",
"dynamic_host_creation"

"dns",
"bind9",
"podman",
"baremetal"
],
"description": "a little collection that creates hosts from prototypes. it also creates private,public keys, random mac and random pass",
"description": "a little collection that creates podman bind 9 container and lets you configure zones",
"license": [
"MIT"
],
"license_file": null,
"dependencies": {
"community.general": ">=0.0.0"
},
"repository": "https://www.github.com/the-pod-shop/host_prototypes",
"repository": "https://www.github.com/the-pod-shop/lil_bind",
"documentation": null,
"homepage": null,
"issues": null
Expand All @@ -32,7 +30,7 @@
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "4dba77037edf0a9797cb6442131087053481bb08275b2bc024b03c8ec315b777",
"chksum_sha256": "b185443791fa3a7255a8398620037b4ea8f834dd9a229ea55f0b532c3b9929bb",
"format": 1
},
"format": 1
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ $ ansible-galaxy collection install ji_podhead.lil_bind
- name: lil_bind
vars:
container_name: "dns"
container_ip: "{{192.168.50.0}}"
container_ip: "192.168.22.2"
dns_admin: "admin"
dns_domain: "dns.com"
bridge_name: "my_bridge"
bridge_ip_range: "192.168.22.128/25"
bridge_subnet: "192.168.22.0/24"
bridge_gateway: "192.168.22.1"
domains: [
{
domain: "pod.com", ip: "192.168.3.0",
Expand All @@ -64,6 +68,10 @@ $ ansible-galaxy collection install ji_podhead.lil_bind
- fire the collection
```yaml
block:
- name: create bridge
import_role:
name: ji_podhead.lil_bind.create_bridge
- name: install bind9
import_role:
name: ji_podhead.lil_bind.install
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace: "ji_podhead"
name: "lil_bind"
description: "a little collection that creates podman bind 9 container and lets you configure zones"
version: "0.0.1"
version: "0.0.4"
readme: "README.md"
authors:
- "ji-podhead (https://https://www.github.com/ji-podhead)"
Expand Down
Binary file removed ji_podhead-lil_bind-0.0.1.tar.gz
Binary file not shown.
Binary file added ji_podhead-lil_bind-0.0.2.tar.gz
Binary file not shown.
Binary file added ji_podhead-lil_bind-0.0.3.tar.gz
Binary file not shown.
Binary file added ji_podhead-lil_bind-0.0.4.tar.gz
Binary file not shown.
38 changes: 38 additions & 0 deletions roles/create_bridge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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).
4 changes: 4 additions & 0 deletions roles/create_bridge/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
domains: []
forwarders: []
subnets: []
54 changes: 54 additions & 0 deletions roles/create_bridge/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
galaxy_info:
author: ji-podhead
description: just a role for kvm and proxmox
company: the-pod-shop

# 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.

# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
dependencies:
- name: jm1.libvirt
version: "2024.5.30"
6 changes: 6 additions & 0 deletions roles/create_bridge/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: Create a podman network
containers.podman.podman_network:
name: "{{bridge_name}}"
ip_range: "{{bridge_ip_range}}"
subnet: "{{bridge_subnet}}"
gateway: "{{bridge_gateway}}"
16 changes: 16 additions & 0 deletions roles/create_bridge/templates/named_conf_local copy 2.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/include "/etc/bind/zones.rfc1918"; \
% for domain in domains %} \
one "{{domain}}" IN { \
type master; \
file "/etc/bind/zones/{{domain}}.de"; \
allow-query { any; }; \
allow-update { any; }; \
; \
one "0.116.10.in-addr.arpa" IN { \
type master; \
file /etc/bind/zones/{{domain}}.rev; \
allow-query { any; }; \
allow-update { any; }; \
; \
% endfor %} \
\
16 changes: 16 additions & 0 deletions roles/create_bridge/templates/named_conf_local copy.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/include "/etc/bind/zones.rfc1918"; \
% for domain in domains %} \
one "{{domain}}" IN { \
type master; \
file "/etc/bind/zones/{{domain}}.de"; \
allow-query { any; }; \
allow-update { any; }; \
; \
one "0.116.10.in-addr.arpa" IN { \
type master; \
file /etc/bind/zones/{{domain}}.rev; \
allow-query { any; }; \
allow-update { any; }; \
; \
% endfor %} \
\
15 changes: 15 additions & 0 deletions roles/create_bridge/templates/named_conf_local.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//include '/etc/bind/zones.rfc1918';
% for domain in domains %}
one '{{domain}}' IN {
type master;
file '/etc/bind/zones/{{domain}}.de';
allow-query { any; };
allow-update { any; };
;
one '0.116.10.in-addr.arpa' IN {
type master;
file /etc/bind/zones/{{domain}}.rev;
allow-query { any; };
allow-update { any; };
;
% endfor %}
25 changes: 25 additions & 0 deletions roles/create_bridge/templates/named_conf_options.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
acl local-lan {
localhost;
# 192.168.2.0/24;
# 192.168.120.0/24;
{% for subnet in subnets %}
{{ subnet }};
{% endfor %}
};
options {
directory '/var/cache/bind';
forwarders {
{% for forwarder in forwarders %}
{{forwarder }};
{% endfor %}
#100.100.100.100;
# the tailscale dns
};
allow-query { local-lan; 100.0.0.0/8 }; # Erlaubt Anfragen nur von den in local-lan definierten Netzwerken
dnssec-validation auto;
auth-nxdomain no; // conform to RFC1035
listen-on-v6 { any; };
recursion no; // we set that to no to avoid unnecessary traffic
querylog yes; // Enable for debugging
version 'not available'; // Disable for security
};
8 changes: 6 additions & 2 deletions roles/install/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

- name: Create yamls
- name: remove old container
ansible.builtin.command: podman rm -f {{container_name}}


- name: install bind9
containers.podman.podman_container:
name: "{{container_name}}"
image: docker.io/ubuntu/bind9:latest
state: started
ports:
- "30053:53"
- "30053:53/udp"
- "30053:53/udp"
ip: "{{container_ip}}"
network: "{{bridge_name}}"

0 comments on commit ec20af3

Please sign in to comment.