Skip to content

Commit

Permalink
add 'tor_' var prefix (#77)
Browse files Browse the repository at this point in the history
ipv4_count -> tor_ipv4_count
v6tmp -> tor_v6tmp
  • Loading branch information
nusenu committed Feb 18, 2017
1 parent 71c0e6d commit 5741e52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ tor_distribution_release: "{{ ansible_lsb.codename }}"
# https://docs.ansible.com/ansible/playbooks_filters_ipaddr.html
tor_v4tmp: "{{ ansible_all_ipv4_addresses | ipv4('address') | ipv4('public') }}"
tor_v4ips: "{{ tor_v4tmp[0:tor_maxPublicIPs] }}"
ipv4_count: "{{ tor_v4ips | length|int }}"
tor_ipv4_count: "{{ tor_v4ips | length|int }}"

# we can not use more IPv6 IPs than we have IPv4 IPs so we truncate (but fewer is ok)
v6tmp: "{{ ansible_all_ipv6_addresses|ipv6('public')|ipv6('address') }}"
tor_v6tmp: "{{ ansible_all_ipv6_addresses|ipv6('public')|ipv6('address') }}"

# the following line is commented out and handled in ip-list.yml until
# https://github.com/ansible/ansible/issues/14829
# gets fixed
#tor_v6ips: "{{ v6tmp[0:ipv4_count|int]|ipv6('address') }}"
#tor_v6ips: "{{ tor_v6tmp[0:tor_ipv4_count|int]|ipv6('address') }}"

tor_RunAsDaemon: 1

Expand Down
6 changes: 3 additions & 3 deletions tasks/ip-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
# we simply convert False to empty lists
- name: workaround for ansible bug 14829 (1/3)
set_fact:
v6tmp: []
when: v6tmp == False
tor_v6tmp: []
when: tor_v6tmp == False

- name: workaround for ansible bug 14829 (2/3)
set_fact:
tor_v6ips: "{{ v6tmp[0:ipv4_count|int]|ipv6('address') }}"
tor_v6ips: "{{ tor_v6tmp[0:tor_ipv4_count|int]|ipv6('address') }}"

- name: workaround for ansible bug 14829 (3/3)
set_fact:
Expand Down
4 changes: 2 additions & 2 deletions vars/private_IPv4_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# filter potentially malicious input from relay-provided IPv4/v6 addresses
# https://docs.ansible.com/ansible/playbooks_filters_ipaddr.html
tor_v4ips: "{{ ansible_all_ipv4_addresses[0:tor_maxPrivateIPs] | ipv4('address') }}"
ipv4_count: "{{ tor_v4ips | length|int }}"
tor_ipv4_count: "{{ tor_v4ips | length|int }}"


# we can not use more IPv6 IPs than we have IPv4 IPs so we truncate (but fewer is ok)
v6tmp: "{{ ansible_all_ipv6_addresses|ipv6('public') }}"
tor_v6tmp: "{{ ansible_all_ipv6_addresses|ipv6('public') }}"

0 comments on commit 5741e52

Please sign in to comment.