First working release

master
Oleg Vasilev 2021-09-12 00:26:15 +03:00
commit 6bbdbe7cf9
5 changed files with 72 additions and 0 deletions

9
CHANGELOG.md Normal file
View File

@ -0,0 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Inital release

44
README.md Normal file
View File

@ -0,0 +1,44 @@
OpenBSD network
===============
An Ansible role for configuring network on OpenBSD.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
Requirements
------------
An installed OpenBSD system with python in it.
Role Variables
--------------
Example configuration. Follow OpenBSD documentation to construct yours.
```yaml
# This is how typical router configuration looks like
openbsd_network_interfaces:
em0: ["dhcp"]
em1: ["up"]
em2: ["up"]
em3: ["up"]
em4: ["up"]
vether0: ["inet 192.168.0.1 255.255.255.0"]
bridge0:
- add vether0
- add em1
- add em2
- add em3
- add em4
- up
```
### TODO:
What to do on configuration changes. Could be "restart", "reload" or "nothing". Variable is mandatory.
```yaml
networkd_apply_action: "restart"
```
License
-------
MIT

4
handlers/main.yml Normal file
View File

@ -0,0 +1,4 @@
---
- name: Network | Apply configuration
shell: ":"

11
tasks/main.yml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Network | Deploy network configs
template:
src: hostname.if.j2
dest: "/etc/hostname.{{ item.key }}"
mode: 0640
owner: root
group: wheel
with_dict: "{{ openbsd_network_interfaces }}"
#notify: Network | Apply

4
templates/hostname.if.j2 Normal file
View File

@ -0,0 +1,4 @@
# {{ ansible_managed | d('Ansible managed') }}
{% for line in item.value %}
{{ line }}
{% endfor %}