Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IPv6 filter workaround #195

Closed
wants to merge 2 commits into from
Closed

Fix IPv6 filter workaround #195

wants to merge 2 commits into from

Conversation

goll
Copy link
Contributor

@goll goll commented Mar 2, 2019

Should fix IPv6 filtering(#80), so the workaround shouldn't be needed anymore.

Test playbook used:

- hosts: localhost
  gather_facts: yes
  vars:
    tor_maxips: 3
    tor_v4ips: "{{ ansible_all_ipv4_addresses[0:tor_maxips] | ipv4('address') }}"
    ipv4_count: "{{ tor_v4ips | length }}"
    v6tmp: "{{ ansible_all_ipv6_addresses | ipv6('address') | ipv6('public') }}"
    tor_v6ips: "{{ v6tmp[0:ipv4_count|int] | ipwrap }}"
  tasks:
  - debug: var=tor_v4ips
  - debug: var=ipv4_count
  - debug: var=v6tmp
  - debug: var=tor_v6ips
  - name: setup IP list (1/2)
    set_fact:
      ips:
          ipv4: "{{ item.0 }}"
          ipv6: "{{ item.1 }}"
    with_together:
          - "{{ tor_v4ips }}"
          - "{{ tor_v6ips }}"
    register: iptest
  - debug:
      var: iptest

Test output with 1 local tor_v4ips and 0 public tor_v6ips:

ok: [localhost] => {
    "iptest": {
        "changed": false,
        "msg": "All items completed",
        "results": [
            {
                "_ansible_ignore_errors": null,
                "_ansible_item_label": [
                    "10.0.2.15",
                    null
                ],
                "_ansible_item_result": true,
                "_ansible_no_log": false,
                "ansible_facts": {
                    "ips": {
                        "ipv4": "10.0.2.15",
                        "ipv6": ""
                    }
                },
                "changed": false,
                "failed": false,
                "item": [
                    "10.0.2.15",
                    null
                ]
            }
        ]
    }
}

Test output with 3 local tor_v4ips and 2 public tor_v6ips:

ok: [localhost] => {
    "iptest": {
        "changed": false,
        "msg": "All items completed",
        "results": [
            {
                "_ansible_ignore_errors": null,
                "_ansible_item_label": [
                    "192.168.0.1",
                    "[IPv6_ADDRESS_1]"
                ],
                "_ansible_item_result": true,
                "_ansible_no_log": false,
                "ansible_facts": {
                    "ips": {
                        "ipv4": "192.168.0.1",
                        "ipv6": "[IPv6_ADDRESS_1]"
                    }
                },
                "changed": false,
                "failed": false,
                "item": [
                    "192.168.0.1",
                    "[IPv6_ADDRESS_1]"
                ]
            },
            {
                "_ansible_ignore_errors": null,
                "_ansible_item_label": [
                    "172.16.0.1",
                    "[IPv6_ADDRESS_2]"
                ],
                "_ansible_item_result": true,
                "_ansible_no_log": false,
                "ansible_facts": {
                    "ips": {
                        "ipv4": "172.16.0.1",
                        "ipv6": "[IPv6_ADDRESS_2]"
                    }
                },
                "changed": false,
                "failed": false,
                "item": [
                    "172.16.0.1",
                    "[IPv6_ADDRESS_2]"
                ]
            },
            {
                "_ansible_ignore_errors": null,
                "_ansible_item_label": [
                    "10.24.50.1",
                    null
                ],
                "_ansible_item_result": true,
                "_ansible_no_log": false,
                "ansible_facts": {
                    "ips": {
                        "ipv4": "10.24.50.1",
                        "ipv6": ""
                    }
                },
                "changed": false,
                "failed": false,
                "item": [
                    "10.24.50.1",
                    null
                ]
            }
        ]
    }
}

@nusenu
Copy link
Owner

nusenu commented Mar 3, 2019

thanks for touching this, did you test it?

@goll
Copy link
Contributor Author

goll commented Mar 3, 2019

managed to run kitchen tests against debian/ubuntu, centos/fedora fail but I believe for known reasons, unfortunately both freebsd/openbsd fail with the bool error when there is no IPv6, which is probably tied to the upstream issue you opened

will close the PR for now since it's still a WIP

@goll goll closed this Mar 3, 2019
@nusenu
Copy link
Owner

nusenu commented Mar 3, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants