Initial commit
This commit is contained in:
commit
0158c0610c
|
|
@ -0,0 +1,196 @@
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/ansible,python,venv,virtualenv
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=ansible,python,venv,virtualenv
|
||||||
|
|
||||||
|
### Ansible ###
|
||||||
|
*.retry
|
||||||
|
|
||||||
|
### Python ###
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
||||||
|
|
||||||
|
### Python Patch ###
|
||||||
|
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
||||||
|
poetry.toml
|
||||||
|
|
||||||
|
# ruff
|
||||||
|
.ruff_cache/
|
||||||
|
|
||||||
|
# LSP config files
|
||||||
|
pyrightconfig.json
|
||||||
|
|
||||||
|
### venv ###
|
||||||
|
# Virtualenv
|
||||||
|
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
||||||
|
[Bb]in
|
||||||
|
[Ii]nclude
|
||||||
|
[Ll]ib
|
||||||
|
[Ll]ib64
|
||||||
|
[Ll]ocal
|
||||||
|
[Ss]cripts
|
||||||
|
pyvenv.cfg
|
||||||
|
pip-selfcheck.json
|
||||||
|
|
||||||
|
### VirtualEnv ###
|
||||||
|
# Virtualenv
|
||||||
|
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/ansible,python,venv,virtualenv
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
image: python:3.17-alpine3.19
|
||||||
|
before_script:
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
A role that installs the very basic version of Netbird, utilizing their install scripts.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
- curl
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
- `netbird_setup_key`: The key that is used to automate the setup process.
|
||||||
|
- `netbird_register`: A true/false defining whether or not register netbird.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
- None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
```yml
|
||||||
|
---
|
||||||
|
- name: Install Netbird
|
||||||
|
hosts: localhost
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
netbird_setup_key: "{{ lookup('env', 'NETBIRD_SETUP_KEY') }}"
|
||||||
|
netbird_register: true
|
||||||
|
tasks:
|
||||||
|
- name: Check for netbird setup key
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "netbird_setup_key is required"
|
||||||
|
when: netbird_setup_key is not defined
|
||||||
|
|
||||||
|
- name: Install Netbird
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: netbird
|
||||||
|
|
||||||
|
- name: Check Netbird Status
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
netbird status --detail
|
||||||
|
```
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
MIT
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
- Mark J. Horninger <sales@dominion.solutions>
|
||||||
|
- Many thanks to [Benjamin Arntzen](https://github.com/Zorlin) for his role that served as a guideline to build this role.
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
# defaults file for netbird
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
# handlers file for netbird
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
galaxy_info:
|
||||||
|
author: Mark Horninger
|
||||||
|
description: your role description
|
||||||
|
company: Dominion Solutions LLC
|
||||||
|
|
||||||
|
# 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: MIT
|
||||||
|
|
||||||
|
min_ansible_version: 9.2.0
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
- mesh
|
||||||
|
- net
|
||||||
|
- netbird
|
||||||
|
- network
|
||||||
|
- security
|
||||||
|
- vpn
|
||||||
|
- wireguard
|
||||||
|
# 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.
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
# tasks file for netbird
|
||||||
|
- name: Check for Netbird Installation
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: netbird --version
|
||||||
|
ignore_errors: true
|
||||||
|
register: netbird_installed
|
||||||
|
|
||||||
|
- name: Install netbird
|
||||||
|
ansible.builtin.shell: curl -fsSL https://pkgs.netbird.io/install.sh | sh
|
||||||
|
when: netbird_installed.rc != 0
|
||||||
|
|
||||||
|
- name: Ensure netbird is not up
|
||||||
|
shell:
|
||||||
|
cmd: 'netbird status | grep "Daemon status"'
|
||||||
|
register: netbird_status
|
||||||
|
changed_when: false
|
||||||
|
ignore_errors: true
|
||||||
|
when: netbird_register is true
|
||||||
|
|
||||||
|
- name: Start Netbird
|
||||||
|
become: true
|
||||||
|
ansible.builtin.shell: netbird up --setup-key="{{ netbird_setup_key }}"
|
||||||
|
when: netbird_register is true and 'NeedsLogin' in netbird_status.stdout
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
localhost
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- netbird
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
# vars file for netbird
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
ansible==9.2.0
|
||||||
|
ansible-core==2.16.3
|
||||||
|
cffi==1.16.0
|
||||||
|
cryptography==42.0.2
|
||||||
|
Jinja2==3.1.3
|
||||||
|
MarkupSafe==2.1.5
|
||||||
|
packaging==23.2
|
||||||
|
pycparser==2.21
|
||||||
|
PyYAML==6.0.1
|
||||||
|
resolvelib==1.0.1
|
||||||
Loading…
Reference in New Issue