robertdebock / ansible-role-openvpn

Install and configure openvpn server or client on your system.
https://robertdebock.nl/
Apache License 2.0
46 stars 16 forks source link

FAILED: The task includes an option with an undefined variable #14

Closed vldanch closed 1 year ago

vldanch commented 1 year ago

Describe the bug

The error is in the output

Playbook

---
- name: Run install openvpn server
  hosts: openvpn-yandex-cloud-server
  remote_user: user
  become: True
  gather_facts: False

  roles:
    - role: roles/ansible-role-openvpn
      vars:
        openvpn_role: "server"
      tags: openvpn-server-install

Output

[A clear and concise description of what the bug is.](fatal: [openvpn-sec01-infra-ru]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: {{ _openvpn_easyrsa_path[ansible_os_family] | default(_openvpn_easyrsa_path['default']) }}: 'ansible_os_family' is undefined\n\nThe error appears to be in '/home/user/Desktop/projects/infra/base-automation/roles/ansible-role-openvpn/tasks/server.yml': line 9, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Easyrsa init-pki\n ^ here\n"})

Environment

NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
ansible 2.10.8
robertdebock commented 1 year ago

Hi,

Please set gather_facts to true.

The role use ansible_os_family, which is a variable that is defined when gather_facts is enabled.

Regards,

Robert.