mirror of
https://github.com/netbirdio/ansible-netbird.git
synced 2026-05-22 18:43:36 -07:00
updates
This commit is contained in:
@@ -33,7 +33,7 @@ This collection provides comprehensive management of NetBird resources:
|
||||
### From Ansible Galaxy (when published)
|
||||
|
||||
```bash
|
||||
ansible-galaxy collection install community.netbird
|
||||
ansible-galaxy collection install community.ansible_netbird
|
||||
```
|
||||
|
||||
### From Source
|
||||
@@ -58,7 +58,7 @@ All modules require API authentication. You can provide credentials in three way
|
||||
|
||||
```yaml
|
||||
- name: List peers
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: peers
|
||||
@@ -73,7 +73,7 @@ export NETBIRD_API_TOKEN="your-personal-access-token"
|
||||
|
||||
```yaml
|
||||
- name: List peers (uses environment variables)
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
resource: peers
|
||||
```
|
||||
|
||||
@@ -85,7 +85,7 @@ export NETBIRD_API_TOKEN="your-personal-access-token"
|
||||
netbird_api_url: "https://netbird.example.com"
|
||||
netbird_api_token: "{{ vault_netbird_token }}"
|
||||
roles:
|
||||
- community.netbird
|
||||
- community.ansible_netbird
|
||||
```
|
||||
|
||||
## Modules
|
||||
@@ -97,7 +97,7 @@ Manage NetBird users (regular and service users).
|
||||
```yaml
|
||||
# Create a regular user
|
||||
- name: Create user
|
||||
community.netbird.netbird_user:
|
||||
community.ansible_netbird.netbird_user:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
email: "user@example.com"
|
||||
@@ -109,7 +109,7 @@ Manage NetBird users (regular and service users).
|
||||
|
||||
# Create a service user
|
||||
- name: Create service user
|
||||
community.netbird.netbird_user:
|
||||
community.ansible_netbird.netbird_user:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "automation-service"
|
||||
@@ -124,7 +124,7 @@ Manage NetBird groups.
|
||||
|
||||
```yaml
|
||||
- name: Create a group
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "production-servers"
|
||||
@@ -140,7 +140,7 @@ Manage NetBird peer settings.
|
||||
|
||||
```yaml
|
||||
- name: Configure peer
|
||||
community.netbird.netbird_peer:
|
||||
community.ansible_netbird.netbird_peer:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
peer_id: "peer-id-123"
|
||||
@@ -156,7 +156,7 @@ Manage NetBird setup keys for peer enrollment.
|
||||
|
||||
```yaml
|
||||
- name: Create reusable setup key
|
||||
community.netbird.netbird_setup_key:
|
||||
community.ansible_netbird.netbird_setup_key:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "server-enrollment"
|
||||
@@ -180,7 +180,7 @@ Manage NetBird access policies.
|
||||
|
||||
```yaml
|
||||
- name: Create access policy
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "developers-to-servers"
|
||||
@@ -206,7 +206,7 @@ Manage NetBird networks.
|
||||
|
||||
```yaml
|
||||
- name: Create network
|
||||
community.netbird.netbird_network:
|
||||
community.ansible_netbird.netbird_network:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "office-network"
|
||||
@@ -220,7 +220,7 @@ Manage NetBird routes (deprecated API, prefer networks).
|
||||
|
||||
```yaml
|
||||
- name: Create route
|
||||
community.netbird.netbird_route:
|
||||
community.ansible_netbird.netbird_route:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
network_id: "internal-route"
|
||||
@@ -242,7 +242,7 @@ Manage NetBird DNS settings and nameserver groups.
|
||||
```yaml
|
||||
# Create nameserver group
|
||||
- name: Create DNS nameserver group
|
||||
community.netbird.netbird_dns:
|
||||
community.ansible_netbird.netbird_dns:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource_type: nameserver_group
|
||||
@@ -259,7 +259,7 @@ Manage NetBird DNS settings and nameserver groups.
|
||||
|
||||
# Update DNS settings
|
||||
- name: Configure DNS settings
|
||||
community.netbird.netbird_dns:
|
||||
community.ansible_netbird.netbird_dns:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource_type: settings
|
||||
@@ -274,7 +274,7 @@ Manage NetBird posture checks for security compliance.
|
||||
|
||||
```yaml
|
||||
- name: Create version check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "minimum-version"
|
||||
@@ -285,7 +285,7 @@ Manage NetBird posture checks for security compliance.
|
||||
state: present
|
||||
|
||||
- name: Create geo-location check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "allowed-countries"
|
||||
@@ -304,7 +304,7 @@ Manage NetBird account settings.
|
||||
|
||||
```yaml
|
||||
- name: Configure account settings
|
||||
community.netbird.netbird_account:
|
||||
community.ansible_netbird.netbird_account:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
peer_login_expiration_enabled: true
|
||||
@@ -323,7 +323,7 @@ Manage NetBird personal access tokens.
|
||||
|
||||
```yaml
|
||||
- name: Create access token
|
||||
community.netbird.netbird_token:
|
||||
community.ansible_netbird.netbird_token:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
user_id: "user-id-123"
|
||||
@@ -344,21 +344,21 @@ Gather information about NetBird resources.
|
||||
|
||||
```yaml
|
||||
- name: Get all peers
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: peers
|
||||
register: peers
|
||||
|
||||
- name: Get all groups
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: groups
|
||||
register: groups
|
||||
|
||||
- name: Get current user
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: current_user
|
||||
@@ -401,7 +401,7 @@ The collection includes a role for declarative configuration:
|
||||
state: present
|
||||
|
||||
roles:
|
||||
- community.netbird
|
||||
- community.ansible_netbird
|
||||
```
|
||||
|
||||
See `defaults/main.yml` for all available role variables.
|
||||
|
||||
+42
-2
@@ -67,15 +67,54 @@ netbird_policies: []
|
||||
# action: "accept"
|
||||
# state: present
|
||||
|
||||
# Network management
|
||||
# Network management (with routers and resources for full routing support)
|
||||
netbird_networks: []
|
||||
# Example:
|
||||
# netbird_networks:
|
||||
# - name: "office-network"
|
||||
# description: "Main office network"
|
||||
# routers:
|
||||
# - peer: "gateway-peer-id" # Use either peer or peer_groups
|
||||
# metric: 100 # Lower = higher priority
|
||||
# masquerade: true # NAT traffic through this router
|
||||
# - peer_groups: # For HA with multiple routers
|
||||
# - "backup-gateways-group"
|
||||
# metric: 200
|
||||
# masquerade: true
|
||||
# resources:
|
||||
# - address: "10.0.0.0/8" # Network CIDR
|
||||
# name: "internal-range"
|
||||
# description: "All internal IPs"
|
||||
# groups: # Who can access this resource
|
||||
# - "all-users-group-id"
|
||||
# - address: "192.168.0.0/16"
|
||||
# name: "private-networks"
|
||||
# groups:
|
||||
# - "developers-group-id"
|
||||
# state: present
|
||||
#
|
||||
# - name: "simple-network"
|
||||
# description: "Network without routing (container only)"
|
||||
# state: present
|
||||
#
|
||||
# - name: "domain-routing"
|
||||
# description: "Route traffic based on domain names"
|
||||
# routers:
|
||||
# - peer: "dns-gateway-peer-id"
|
||||
# metric: 100
|
||||
# masquerade: true
|
||||
# resources:
|
||||
# - address: "internal.example.com" # Single domain
|
||||
# name: "internal-portal"
|
||||
# groups:
|
||||
# - "all-users-group-id"
|
||||
# - address: "*.corp.example.com" # Wildcard for all subdomains
|
||||
# name: "corp-subdomains"
|
||||
# groups:
|
||||
# - "employees-group-id"
|
||||
# state: present
|
||||
|
||||
# Route management (deprecated API, prefer networks)
|
||||
# Route management (deprecated API, prefer networks with routers/resources)
|
||||
netbird_routes: []
|
||||
# Example:
|
||||
# netbird_routes:
|
||||
@@ -128,3 +167,4 @@ netbird_account_settings: {}
|
||||
# peer_inactivity_expiration_enabled: false
|
||||
# jwt_groups_enabled: false
|
||||
# dns_domain: "netbird.example.com"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
tasks:
|
||||
- name: Gather current NetBird information
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: current_user
|
||||
@@ -25,7 +25,7 @@
|
||||
msg: "Connected as: {{ current_user.data.email }}"
|
||||
|
||||
- name: Create a group for developers
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "developers"
|
||||
@@ -33,7 +33,7 @@
|
||||
register: developers_group
|
||||
|
||||
- name: Create a group for servers
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "servers"
|
||||
@@ -41,7 +41,7 @@
|
||||
register: servers_group
|
||||
|
||||
- name: Create a setup key for new servers
|
||||
community.netbird.netbird_setup_key:
|
||||
community.ansible_netbird.netbird_setup_key:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "server-enrollment"
|
||||
@@ -58,7 +58,7 @@
|
||||
when: server_key.changed
|
||||
|
||||
- name: Create a policy allowing developers to access servers
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "developers-to-servers"
|
||||
@@ -78,3 +78,4 @@
|
||||
- "8080"
|
||||
action: "accept"
|
||||
state: present
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
tasks:
|
||||
- name: Get all existing groups
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: groups
|
||||
@@ -64,7 +64,7 @@
|
||||
msg: "Available groups: {{ group_map.keys() | list }}"
|
||||
|
||||
- name: Create policies dynamically
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
name: "{{ item.name }}"
|
||||
@@ -85,3 +85,4 @@
|
||||
when: >
|
||||
(item.source_groups | difference(group_map.keys() | list) | length == 0) and
|
||||
(item.destination_groups | difference(group_map.keys() | list) | length == 0)
|
||||
|
||||
|
||||
@@ -121,11 +121,11 @@
|
||||
state: present
|
||||
|
||||
roles:
|
||||
- role: community.netbird
|
||||
- role: community.ansible_netbird
|
||||
|
||||
post_tasks:
|
||||
- name: Gather all peers
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: peers
|
||||
@@ -136,7 +136,7 @@
|
||||
msg: "Total peers: {{ all_peers.count }}"
|
||||
|
||||
- name: Gather all policies
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: policies
|
||||
@@ -145,3 +145,4 @@
|
||||
- name: Display policy summary
|
||||
ansible.builtin.debug:
|
||||
msg: "Total policies: {{ all_policies.count }}"
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
|
||||
tasks:
|
||||
- name: Get all peers from NetBird
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: peers
|
||||
register: all_peers
|
||||
|
||||
- name: Get all groups from NetBird
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: groups
|
||||
@@ -97,3 +97,4 @@
|
||||
- name: Display inventory location
|
||||
ansible.builtin.debug:
|
||||
msg: "Inventory written to: {{ inventory_output_file }}"
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
tasks:
|
||||
- name: Get all peers
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
resource: peers
|
||||
@@ -51,7 +51,7 @@
|
||||
{% endfor %}
|
||||
|
||||
- name: Find and configure server peers
|
||||
community.netbird.netbird_peer:
|
||||
community.ansible_netbird.netbird_peer:
|
||||
api_url: "{{ netbird_api_url }}"
|
||||
api_token: "{{ netbird_api_token }}"
|
||||
peer_id: "{{ item.id }}"
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
# Uncomment to delete stale peers
|
||||
# - name: Delete stale peers
|
||||
# community.netbird.netbird_peer:
|
||||
# community.ansible_netbird.netbird_peer:
|
||||
# api_url: "{{ netbird_api_url }}"
|
||||
# api_token: "{{ netbird_api_token }}"
|
||||
# peer_id: "{{ item.id }}"
|
||||
@@ -88,3 +88,4 @@
|
||||
# loop_control:
|
||||
# label: "{{ item.name }}"
|
||||
# when: stale_peers | length > 0
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
namespace: community
|
||||
name: netbird
|
||||
name: ansible_netbird
|
||||
version: 1.0.0
|
||||
readme: README.md
|
||||
authors:
|
||||
@@ -26,3 +26,4 @@ build_ignore:
|
||||
- 'tests'
|
||||
- 'venv'
|
||||
- '__pycache__'
|
||||
|
||||
|
||||
@@ -48,3 +48,4 @@ galaxy_info:
|
||||
- security
|
||||
|
||||
dependencies: []
|
||||
|
||||
|
||||
@@ -30,3 +30,4 @@ options:
|
||||
default: true
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@@ -451,18 +451,19 @@ class NetBirdAPI:
|
||||
"""Get a specific network resource."""
|
||||
return self.get(f'/api/networks/{network_id}/resources/{resource_id}')
|
||||
|
||||
def create_network_resource(self, network_id, address, name='', description='', groups=None):
|
||||
def create_network_resource(self, network_id, address, name='', description='', enabled=True, groups=None):
|
||||
"""Create a new network resource."""
|
||||
data = {
|
||||
'address': address,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'enabled': enabled,
|
||||
'groups': groups or []
|
||||
}
|
||||
return self.post(f'/api/networks/{network_id}/resources', data=data)
|
||||
|
||||
def update_network_resource(self, network_id, resource_id, address=None, name=None,
|
||||
description=None, groups=None):
|
||||
description=None, enabled=None, groups=None):
|
||||
"""Update a network resource."""
|
||||
data = {}
|
||||
if address is not None:
|
||||
@@ -471,6 +472,8 @@ class NetBirdAPI:
|
||||
data['name'] = name
|
||||
if description is not None:
|
||||
data['description'] = description
|
||||
if enabled is not None:
|
||||
data['enabled'] = enabled
|
||||
if groups is not None:
|
||||
data['groups'] = groups
|
||||
return self.put(f'/api/networks/{network_id}/resources/{resource_id}', data=data)
|
||||
@@ -674,3 +677,4 @@ def netbird_argument_spec():
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -84,14 +84,14 @@ options:
|
||||
- Enable or disable experimental lazy connection.
|
||||
type: bool
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Enable peer login expiration
|
||||
community.netbird.netbird_account:
|
||||
community.ansible_netbird.netbird_account:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
peer_login_expiration_enabled: true
|
||||
@@ -99,7 +99,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Configure JWT groups
|
||||
community.netbird.netbird_account:
|
||||
community.ansible_netbird.netbird_account:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
jwt_groups_enabled: true
|
||||
@@ -110,14 +110,14 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Configure custom DNS domain
|
||||
community.netbird.netbird_account:
|
||||
community.ansible_netbird.netbird_account:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
dns_domain: "netbird.example.com"
|
||||
state: present
|
||||
|
||||
- name: Configure peer expiration settings
|
||||
community.netbird.netbird_account:
|
||||
community.ansible_netbird.netbird_account:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
peer_login_expiration_enabled: true
|
||||
@@ -127,7 +127,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete an account (use with caution)
|
||||
community.netbird.netbird_account:
|
||||
community.ansible_netbird.netbird_account:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
account_id: "account-id-123"
|
||||
@@ -183,7 +183,7 @@ account:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -330,3 +330,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -102,14 +102,14 @@ options:
|
||||
type: list
|
||||
elements: str
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Create a nameserver group
|
||||
community.netbird.netbird_dns:
|
||||
community.ansible_netbird.netbird_dns:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource_type: nameserver_group
|
||||
@@ -131,7 +131,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Create a primary DNS nameserver group
|
||||
community.netbird.netbird_dns:
|
||||
community.ansible_netbird.netbird_dns:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource_type: nameserver_group
|
||||
@@ -149,7 +149,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Update DNS settings
|
||||
community.netbird.netbird_dns:
|
||||
community.ansible_netbird.netbird_dns:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource_type: settings
|
||||
@@ -158,7 +158,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete a nameserver group
|
||||
community.netbird.netbird_dns:
|
||||
community.ansible_netbird.netbird_dns:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource_type: nameserver_group
|
||||
@@ -210,7 +210,7 @@ nameserver_group:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -408,3 +408,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -47,21 +47,21 @@ options:
|
||||
type: list
|
||||
elements: dict
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Create a group
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "developers"
|
||||
state: present
|
||||
|
||||
- name: Create a group with peers
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "production-servers"
|
||||
@@ -71,7 +71,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Update group peers
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
group_id: "group-id-123"
|
||||
@@ -82,7 +82,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete a group
|
||||
community.netbird.netbird_group:
|
||||
community.ansible_netbird.netbird_group:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
group_id: "group-id-123"
|
||||
@@ -113,7 +113,7 @@ group:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -250,3 +250,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -38,28 +38,28 @@ options:
|
||||
- Only applicable when resource is 'cities'.
|
||||
type: str
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Get all peers
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: peers
|
||||
register: peers_info
|
||||
|
||||
- name: Get all groups
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: groups
|
||||
register: groups_info
|
||||
|
||||
- name: Get all service users
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: users
|
||||
@@ -67,35 +67,35 @@ EXAMPLES = r'''
|
||||
register: service_users_info
|
||||
|
||||
- name: Get current user info
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: current_user
|
||||
register: current_user_info
|
||||
|
||||
- name: Get all policies
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: policies
|
||||
register: policies_info
|
||||
|
||||
- name: Get DNS settings
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: dns_settings
|
||||
register: dns_settings
|
||||
|
||||
- name: Get all events
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: events
|
||||
register: events_info
|
||||
|
||||
- name: Get available countries for geo-location
|
||||
community.netbird.netbird_info:
|
||||
community.ansible_netbird.netbird_info:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
resource: countries
|
||||
@@ -119,7 +119,7 @@ count:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -214,3 +214,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,14 +53,14 @@ options:
|
||||
- Whether approval is required for the peer.
|
||||
type: bool
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Update peer name
|
||||
community.netbird.netbird_peer:
|
||||
community.ansible_netbird.netbird_peer:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
peer_id: "peer-id-123"
|
||||
@@ -68,7 +68,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Enable SSH on peer
|
||||
community.netbird.netbird_peer:
|
||||
community.ansible_netbird.netbird_peer:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
peer_id: "peer-id-123"
|
||||
@@ -76,7 +76,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Configure peer expiration settings
|
||||
community.netbird.netbird_peer:
|
||||
community.ansible_netbird.netbird_peer:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
peer_id: "peer-id-123"
|
||||
@@ -85,7 +85,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete a peer
|
||||
community.netbird.netbird_peer:
|
||||
community.ansible_netbird.netbird_peer:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
peer_id: "peer-id-123"
|
||||
@@ -158,7 +158,7 @@ peer:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -265,3 +265,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -96,14 +96,14 @@ options:
|
||||
type: str
|
||||
default: accept
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Create a policy allowing all traffic between groups
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "Allow developers to production"
|
||||
@@ -121,7 +121,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Create a policy with specific ports
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "Web traffic only"
|
||||
@@ -139,7 +139,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Disable a policy
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
policy_id: "policy-id-123"
|
||||
@@ -147,7 +147,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete a policy
|
||||
community.netbird.netbird_policy:
|
||||
community.ansible_netbird.netbird_policy:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
policy_id: "policy-id-123"
|
||||
@@ -178,7 +178,7 @@ policy:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -320,3 +320,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -119,14 +119,14 @@ options:
|
||||
type: list
|
||||
elements: dict
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Create a NetBird version check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "minimum-version"
|
||||
@@ -137,7 +137,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Create a geo-location check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "allowed-countries"
|
||||
@@ -152,7 +152,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Create a network range check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "office-networks"
|
||||
@@ -166,7 +166,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Create an OS version check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
name: "os-requirements"
|
||||
@@ -180,7 +180,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete a posture check
|
||||
community.netbird.netbird_posture_check:
|
||||
community.ansible_netbird.netbird_posture_check:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
check_id: "check-id-123"
|
||||
@@ -208,7 +208,7 @@ posture_check:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -343,3 +343,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -86,14 +86,14 @@ options:
|
||||
type: list
|
||||
elements: str
|
||||
extends_documentation_fragment:
|
||||
- community.netbird.netbird
|
||||
- community.ansible_netbird.netbird
|
||||
requirements:
|
||||
- python >= 3.6
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Create a route to internal network
|
||||
community.netbird.netbird_route:
|
||||
community.ansible_netbird.netbird_route:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
network_id: "internal-route"
|
||||
@@ -108,7 +108,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Create a route with peer groups
|
||||
community.netbird.netbird_route:
|
||||
community.ansible_netbird.netbird_route:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
network_id: "ha-route"
|
||||
@@ -124,7 +124,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Disable a route
|
||||
community.netbird.netbird_route:
|
||||
community.ansible_netbird.netbird_route:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
route_id: "route-id-123"
|
||||
@@ -132,7 +132,7 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
|
||||
- name: Delete a route
|
||||
community.netbird.netbird_route:
|
||||
community.ansible_netbird.netbird_route:
|
||||
api_url: "https://netbird.example.com"
|
||||
api_token: "{{ netbird_token }}"
|
||||
route_id: "route-id-123"
|
||||
@@ -178,7 +178,7 @@ route:
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.netbird.plugins.module_utils.netbird_api import (
|
||||
from ansible_collections.community.ansible_netbird.plugins.module_utils.netbird_api import (
|
||||
NetBirdAPI,
|
||||
NetBirdAPIError,
|
||||
netbird_argument_spec
|
||||
@@ -364,3 +364,4 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user