Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

configuring ha interface with panos_interface #193

Closed
laurent-perrin opened this issue Nov 12, 2018 · 3 comments
Closed

configuring ha interface with panos_interface #193

laurent-perrin opened this issue Nov 12, 2018 · 3 comments

Comments

@laurent-perrin
Copy link

laurent-perrin commented Nov 12, 2018

When configuring a HA interface with panos_interface, the zone_name option should not be mandatory.

I've tried to use a "ha" zone but it's not working.

The code:

- name: configure ha interface
  panos_interface:
    ip_address: "{{ inventory_hostname }}"
    username: "{{ ansible_user }}"
    password: "{{ ansible_password }}"
    if_name: "ethernet1/1"
    mode: "ha"
    zone_name: "ha"
    enable_dhcp: false
    state: present
  tags: ha

The error log:

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_panos_interface_payload_tjTsdE/__main__.py", line 385, in main
    changed |= set_zone(con, eth, zone_name, zones)
  File "/tmp/ansible_panos_interface_payload_tjTsdE/__main__.py", line 212, in set_zone
    z.create()
  File "/home/adminsip/virtenv/ansible2.7/local/lib/python2.7/site-packages/pandevice/base.py", line 576, in create
    device.active().xapi.set(self.xpath_short(), element, retry_on_peer=self.HA_SYNC)
  File "/home/adminsip/virtenv/ansible2.7/local/lib/python2.7/site-packages/pandevice/base.py", line 3253, in method
    raise the_exception

fatal: [cloud-fw-y02n-prd.cloud.620nm.net]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "adjust_tcp_mss": null, 
            "aggregate_group": null, 
            "api_key": null, 
            "comment": null, 
            "commit": true, 
            "create_default_route": false, 
            "dhcp_default_route_metric": null, 
            "enable_dhcp": false, 
            "if_name": "ethernet1/1", 
            "ip": null, 
            "ip_address": "cloud-fw-y02n-prd.cloud.620nm.net", 
            "ipv4_mss_adjust": null, 
            "ipv6_enabled": null, 
            "ipv6_mss_adjust": null, 
            "link_duplex": null, 
            "link_speed": null, 
            "link_state": null, 
            "lldp_enabled": null, 
            "lldp_profile": null, 
            "management_profile": null, 
            "mode": "ha", 
            "mtu": null, 
            "netflow_profile": null, 
            "netflow_profile_l2": null, 
            "operation": "add", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "state": "present", 
            "username": "iac_user", 
            "vr_name": "default", 
            "vsys_dg": "vsys1", 
            "zone_name": "ha"
        }
    }, 
    "msg": "Failed zone/vr assignment:  ha -> network -> ha unexpected here\n ha -> network is invalid"
}
@darren-jones-nz
Copy link
Contributor

Try this branch, https://github.com/geraint-jones-nz/ansible-pan/tree/ISS-193

I have made it not set zone or vr if the mode is ha, let me know if this works for you and I will sort out a pull request.

@laurent-perrin
Copy link
Author

I tried your fix but I get this error:

TASK [panos : configure ha interface] *****************************************************************************************************************************************************************************
task path: /home/fgzx6022/Work/ansible-role/panos/tasks/ha.yml:1
Tuesday 26 March 2019  10:44:55 +0100 (0:00:00.387)       0:00:02.316 ********* 
The full traceback is:
Traceback (most recent call last):
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 612, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/plugins/action/normal.py", line 46, in run
    result = merge_hash(result, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 742, in _execute_module
    (module_style, shebang, module_data, module_path) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 178, in _configure_module
    environment=final_environment)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/module_common.py", line 973, in modify_module
    environment=environment)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/module_common.py", line 791, in _find_module_utils
    recursive_finder(module_name, b_module_data, py_module_names, py_module_cache, zf)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/module_common.py", line 538, in recursive_finder
    tree = ast.parse(data)
  File "/usr/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 387
    if mode not 'ha':
                   ^
SyntaxError: invalid syntax

fatal: [cloud-fw-z01r-prd.cloud.620nm.net]: FAILED! => {
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}
The full traceback is:
Traceback (most recent call last):
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 612, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/plugins/action/normal.py", line 46, in run
    result = merge_hash(result, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 742, in _execute_module
    (module_style, shebang, module_data, module_path) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 178, in _configure_module
    environment=final_environment)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/module_common.py", line 973, in modify_module
    environment=environment)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/module_common.py", line 791, in _find_module_utils
    recursive_finder(module_name, b_module_data, py_module_names, py_module_cache, zf)
  File "/home/fgzx6022/Work/python-env/ansible2.7/local/lib/python2.7/site-packages/ansible/executor/module_common.py", line 538, in recursive_finder
    tree = ast.parse(data)
  File "/usr/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 387
    if mode not 'ha':
                   ^
SyntaxError: invalid syntax

fatal: [cloud-fw-z02r-prd.cloud.620nm.net]: FAILED! => {
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}
	to retry, use: --limit @/home/fgzx6022/Work/PF-FW-Virtuels/ansible/panos.retry

@shinmog
Copy link
Collaborator

shinmog commented Apr 17, 2019

Fixed by #268

@shinmog shinmog closed this as completed Apr 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants