robertdebock.openvpn

Ansible Role OpenVPN

This role helps you install and set up an OpenVPN server or client on your system.

GitHub GitLab Downloads Version
github gitlab downloads Version

Example Playbook

Below is an example playbook that sets up OpenVPN. This example is also tested with every update.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  tasks:
    - name: Create OpenVPN server
      ansible.builtin.include_role:
        name: robertdebock.openvpn
      vars:
        openvpn_role: "server"

    - name: Copy certificates and keys from server to client
      ansible.builtin.copy:
        src: /etc/openvpn/easy-rsa/pki/{{ item }}
        dest: /etc/openvpn/client/{{ item | basename }}
        mode: "0640"
        remote_src: true
      loop:
        - ca.crt
        - issued/client.crt
        - private/client.key
        - ta.key

    - name: Create OpenVPN client
      ansible.builtin.include_role:
        name: robertdebock.openvpn
      vars:
        openvpn_role: "client"
        openvpn_client_server: "127.0.0.1"

Before running this setup, your machine needs preparation. In continuous integration (CI), this is done using the following file:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap
    - role: robertdebock.epel

You can refer to this full explanation and example on how to utilize these roles.

Role Variables

The default values for the role variables are found in the defaults/main.yml file:

---
# defaults file for OpenVPN

# You can set up both a client and a server using this role.
# Use `server` or `client` for `openvpn_role`.

openvpn_role: server

# If configuring a client, set these variables:
# openvpn_role: client
# openvpn_client_server: vpn.example.com

Requirements

  • Pip packages listed in the requirements.txt file.

State of Used Roles

These roles are used to prepare the system. You can also use a different way to prepare it.

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab
robertdebock.epel Build Status GitHub Build Status GitLab

Context

This role is part of several compatible roles. For more information, check out the documentation for those roles.

dependencies

Compatibility

This role works with these container images:

Container Tags
EL 9
Debian all
Ubuntu focal

You need at least Ansible version 2.12. Testing has been done with the previous, current, and development versions.

If you encounter any issues, please report them on GitHub.

License

This role is licensed under the Apache-2.0.

Author Information

This role is created by robertdebock.

If you wish to support me, please consider sponsoring me.

Informazioni sul progetto

Install and configure openvpn server or client on your system.

Installa
ansible-galaxy install robertdebock.openvpn
Licenza
apache-2.0
Download
25.8k
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.