Commit 0b1c8147 authored by Mark Beierl's avatar Mark Beierl
Browse files

Adding Ansible to Firewall



Fixes ansible handling
Adds playbooks to add/remove port forwarding
Forces public/management IP down on virtual pc after installation

Signed-off-by: default avatarbeierlm <mark.beierl@canonical.com>
parent a9478002
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
# Vyos-config

This is a proxy charm used by Open Source Mano (OSM) to configure Vyos Router PNF, written in the [Python Operator Framwork](https://github.com/canonical/operator)
+46 −0
Original line number Diff line number Diff line
# VyOS Action
add-port-forward:
  description: "Adds a port forwarding rule"
  params:
    ruleNumber:
        description: "Rule number, must be unique and needed to remove the rule later"
        type: "string"
        default: "10"
    sourcePort:
        description: "Source port to listen on"
        type: "string"
    destinationPort:
        description: "Target port number on remote host to forward"
        type: "string"
    destinationAddress:
        description: "Target host or IP address to forward traffic"
        type: "string"
  required:
    - sourcePort
    - destinationPort
    - destinationAddress

remove-port-forward:
  description: "Removes a port forwarding rule by number"
  params:
    ruleNumber:
        description: "Rule number to remove"
        type: "string"
        default: "10"

# Required by charms.osm.sshproxy
run:
  description: "Run an arbitrary command"
  params:
    command:
      description: "The command to execute."
      type: string
      default: ""
  required:
    - command
generate-ssh-key:
  description: "Generate a new SSH keypair for this unit. This will replace any existing previously generated keypair."
verify-ssh-credentials:
  description: "Verify that this unit can authenticate with server specified by ssh-hostname and ssh-username."
get-ssh-public-key:
  description: "Get the public SSH key for this unit."
+25 −0
Original line number Diff line number Diff line
options:
    ssh-hostname:
        type: string
        default: ""
        description: "The hostname or IP address of the machine to"
    ssh-username:
        type: string
        default: ""
        description: "The username to login as."
    ssh-password:
        type: string
        default: ""
        description: "The password used to authenticate."
    ssh-public-key:
        type: string
        default: ""
        description: "The public key of this unit."
    ssh-key-type:
        type: string
        default: "rsa"
        description: "The type of encryption to use for the SSH key."
    ssh-key-bits:
        type: int
        default: 4096
        description: "The number of bits to use for the SSH key."
+11 −0
Original line number Diff line number Diff line
name: vyos-config
summary: A proxy charm to configure VyOS Router
maintainer: David García <david.garcia@canonical.com>
description: |
  Charm to configure VyOS PNF
series:
  - xenial
  - bionic
peers:
  proxypeer:
    interface: proxypeer
+13 −0
Original line number Diff line number Diff line
- hosts: vyos-routers
  gather_facts: false
  connection: local
  tasks:
    - name: backup switch (vyos)
      vyos_config:
        lines:
          - nat destination rule {{ ruleNumber }} destination port "{{ sourcePort }}"
          - nat destination rule {{ ruleNumber }} inbound-interface "eth0"
          - nat destination rule {{ ruleNumber }} protocol "tcp"
          - nat destination rule {{ ruleNumber }} translation port    "{{ destinationPort }}"
          - nat destination rule {{ ruleNumber }} translation address "{{ destinationAddress }}"
        save: yes
Loading