Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ji-podhead authored Aug 20, 2024
1 parent ef4b8cb commit e8c9ed6
Showing 1 changed file with 59 additions and 23 deletions.
82 changes: 59 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,63 @@
# lil_bind
# lil_bind Ansible Galaxy Collection


---
lil_bind installs Bind9 podman container and configures a ***static DNS*** for you

## Usage
---
- one domain and ip per zone
- subdomains can be used, or just left blank

i dont need a dhcp for my iac stuff, but still need a dns, so it was not intendet to make use of dynamic updates since all my containers and vms have a static ip because of the nic's (bridges/nats) anyway, so i decided just to use a tailscale router and instead of dhcp ill use a little netkwork manager that gives ip by the given zone. So i just have a preset file that contains all my zones and subnets and the networkmanager will cycle ips in the given subnet and zone.

```yaml
- name: get_dns_ip
register: telepod_ip
debug:
msg: # -------- >> just an example how you can get secrets and use it with lil_bind << ---------
"{{ lookup('community.hashi_vault.vault_kv2_get', 'workshop' , engine_mount_point='keyvalue', url='http://127.0.0.1:8200', token=vault_token)['data']['data']['telepod_ip'] }}"
- name: install podman
ansible.builtin.yum:
name:
- podman
state: latest

- name: lil_bind # --------- >> we use a block, so we just define the vars once and some are needed by multiple roles << ---------
vars:
## Usage
- import collection and use root

```yaml

- hosts: <your_host>
gather_facts: no
become: true
become_method: sudo
become_user: root
collections:
- ji_podhead.lil_bind
```
- put all variables in a block because some are needed for multiple roles and we dont like redundancy
```yaml
tasks:
- name: install podman
ansible.builtin.yum:
name:
- podman
state: latest
- name: lil_bind
vars:
container_name: "dns"
container_ip: "{{192.168.50.0}}"
dns_admin: "admin"
dns_domain: "dns.com"
domains: [
{domain: "pod.com", ip: "{{telepod_ip.msg}}", # ----------- >> we define a few domains and subdomains << -----------
sub_domains: [{sub_domain: "tele", ip: "{{telepod_ip.msg.split('.')[-1]}}"}]},
{domain: "test.com", ip: "192.168.2.120",
sub_domains: [{sub_domain: "test", ip: "120"}]}
]
forwarders: [100.100.100.100] # ----------- >> needed for named.conf.local & named.conf.options << -----------
{
domain: "pod.com", ip: "192.168.3.0",
sub_domains: [{sub_domain: "tele", ip: 2}]
},
{
domain: "test.com", ip: "192.168.2.120",
sub_domains: [{sub_domain: "test", ip: "121"}]
}
]
forwarders: [100.100.100.100]
subnets: [192.168.0.0/16,100.0.0.0/8]
allow_queries: ["localhost","192.168.0.0/16","100.0.0.0/8"]

```

- fire the collection
```yaml
block:
- name: install bind9
import_role:
Expand All @@ -38,8 +70,12 @@
- name: set_zones
import_role:
name: ji_podhead.lil_bind.set_zones

- name: update & restart bind9
import_role:
name: ji_podhead.lil_bind.update
```
```

---

## output

0 comments on commit e8c9ed6

Please sign in to comment.