Hi,
I want to deploy a couple of OpenVPN configs to multiple users. It works
for a single user but now I'm stuck trying to make it work for multiple
users. Anyone have a suggestion how to make this work?
Variables:
---
openvpn_networks:
site1:
openvpn_config: site1-server1
site2:
openvpn_config: site2-server1
openvpn_users:
- name: patrick
base: /home/
- name: test
base: /home/
The task below works (apologies for the wrapping):
ansible/roles/openvpn/client/tasks/main.yml
---
- name: install openvpn NetworkManager client config(s)
template:
src: "{{ item }}/openvpn_networks[item].openvpn_config }}.j2"
dest: "/home/patrick/{{openvpn_networks[item].openvpn_config }}.ovpn"
mode: 0644
with_items:
- '{{ openvpn_networks | list }}'
But I can't figure out how to do this for multiple users as it fails
with: the field 'args' has an invalid value, which appears to include a
variable that is undefined. The error was: 'unicode object' has no
attribute 'base'
- name: install multi-user openvpn NetworkManager client config(s)
template:
src: "{{ item }}/{{ openvpn_networks[item].openvpn_config }}.j2"
dest: "{{ item.2.base }}/{{ item.2.name }}/test/{{
openvpn_networks[item].openvpn_config }}.ovpn"
owner: "{{ item.2.name }}"
group: "{{ item.2.name }}"
mode: 0644
with_items:
- '{{ openvpn_networks | list }}'
- '{{ openvpn_users }}'
How to make this work (possibly in a better way)?
Thanks a bunch!
Patrick
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/405dc493-5cf8-3b77-881b-462a5f3a86c6%40laimbock.com.
For more options, visit https://groups.google.com/d/optout.