要在服务器上安装 Open-VPN,我遵循以下命令:
安装 Ansible 和 Git:
sudo apt-get install -y python3-pip git rsync ansible
克隆此存储库:
git clone https://github.com/d3vilh/openvpn-aws
然后进入存储库目录:
cd openvpn-aws
安装要求:
ansible-galaxy collection install -r requirements.yml --force
如果您看到 ansible-galaxy:未找到命令,则必须重新登录然后重试。
复制配置文件并根据您的环境进行修改:
yes | cp -p example.config.yml config.yml
如果不存在docker组,则运行以下命令添加docker组,并将用户添加到docker组:
sudo groupadd docker
sudo usermod -aG docker $USER
立即重新登录以应用组更改。
`Double check that ansible_user is correct for inventory.yml. Nee`d to run installtion on the remote server - follow the recomendations in config file.
`nano inventory.yml`, save the file - `Ctrl+O` and `Ctrl+X` to exit.
运行安装剧本:
sudo ansible-playbook main.yml
按照所有安装 OpenVPN 的说明后,我遇到了这个错误。
> fatal: [openvpn-aws]: FAILED! => {"reason": "couldn't resolve > module/action 'community.docker.docker_compose_v2'. This often > indicates a misspelling, missing collection, or incorrect module > path.\n\nThe error appears to be in > '/home/ubuntu/openvpn-aws/tasks/openvpn_ubuntu.yml': line 37, column > 3, but may\nbe elsewhere in the file depending on the exact syntax > problem.\n\nThe offending line appears to be:\n\n# to the `docker` > group, so this task may fail.\n- name: Ensure OpenVPN is running > (Ubuntu).\n ^ here\n"}
我尝试过不同的解决方案来安装 OpenVPN,但都没有成功。我在网上搜索了有关使用 Docker 文件和更改 openvpn_ubuntu.yml 文件中的参数的说明,但它们没有帮助。您对如何正确安装 OpenVPN 有什么想法吗?
这是错误中提到的这个文件的第37到40行:
> 37 - name: Ensure OpenVPN is running (Ubuntu).
> 38 community.docker.docker_compose_v2:
> 39 project_src: "{{/home/ubuntu/openvpn-aws}}"
> 40 state: present