# Options variables aren't extracted

**URL:** <https://forum.ansible.com/t/options-variables-arent-extracted/7696>\
**Category:** Get Help\
**Tags:** ansible-core\
**Created:** [August 7, 2024, 6:35am UTC](https://forum.ansible.com/t/options-variables-arent-extracted/7696 "2024-08-07T06:35:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chkp-edenbr](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chkp-edenbr/32/4378_2.png) [@chkp-edenbr](https://forum.ansible.com/u/chkp-edenbr)\
**Post date:** [August 7, 2024, 6:35am UTC](https://forum.ansible.com/t/options-variables-arent-extracted/7696/1 "2024-08-07T06:35:53Z")

</div>

I’m running on Ansible version 2.15.8 with the latest Check Point MGMT collection, and i noticed that suddenly i cant use the options.  
Our httpapi plugin has several options, for example domain (snippet from checkpony.py httpapi plugin)

```auto
options:
  domain:
    type: str
    description:
      - Specifies the domain of the Check Point device
    vars:
      - name: ansible_checkpoint_domain

```

Below is my inventory.ini file content:

```auto
[my_hosts]
target_host ansible_connection=httpapi ansible_httpapi_host=172.23.3.10 ansible_host=172.23.3.10 ansible_httpapi_use_ssl=true ansible_httpapi_validate_certs=false ansible_network_os=check_point.mgmt.checkpoint ansible_user=aa ansible_password=aaaa

[my_hosts:vars]
ansible_checkpoint_domain=dom1

```

and i noticed that when running a playbook the plugin isn’t extracting the option correctly, i’ve added a print of cp\_domain and got ‘None’,

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/7/7776dea4aeaceb1b48feda13a624b849d35e50ed.png)

but when running the task below in my playbook:

```auto
    - name: Print inventory variable
      ansible.builtin.debug:
        var: ansible_checkpoint_domain

```

i get the correct output

TASK [Print inventory variable] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [target\_host] =\> {  
“ansible\_checkpoint\_domain”: “dom1”  
}

I ran my playbook in an ansible 2.12 virtual environment and the options were extracted successfully, when doing so in a different virtual environment version 2.14 it didn’t seem to do so.

---

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [August 7, 2024, 5:53pm UTC](https://forum.ansible.com/t/options-variables-arent-extracted/7696/2 "2024-08-07T17:53:33Z")

</div>

I cannot replicate your issue with `stable-2.14`, `stable-2.15`, or `stable-2.16` and the information you provided.

I used your inventory with the following playbook:

```yaml
- hosts: target_host
  gather_facts: false
  tasks:
    - check_point.mgmt.cp_mgmt_add_api_key:
        admin_name: foo

```

and this patch:

```diff
diff --git a/plugins/httpapi/checkpoint.py b/plugins/httpapi/checkpoint.py
index 6e8f45e..76a3a1b 100644
--- a/plugins/httpapi/checkpoint.py
+++ b/plugins/httpapi/checkpoint.py
@@ -59,6 +59,7 @@ class HttpApi(HttpApiBase):
     def login(self, username, password):
         payload = {}
         cp_domain = self.get_option("domain")
+ raise Exception(cp_domain)
         cp_api_key = self.get_option("api_key")
         if cp_domain:
             payload["domain"] = cp_domain

```

The result was, as expected,

```plaintext
TASK [check_point.mgmt.cp_mgmt_add_api_key] ************************************
An exception occurred during task execution. To see the full traceback, use -vvv
. The error was: ansible.module_utils.connection.ConnectionError: dom1

```

I do recall an issue with very old versions of `ansible.netcommon` and `httpapi` plugin options; you might want to make sure you don’t have an old install of that collection lying around.

`stable-2.17` and on are broken due to [an import](https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/blob/c0a6f34c556b027fdaae37e4281abc94c9983e9f/plugins/module_utils/checkpoint.py#L35) that was [removed in October 2023](https://github.com/ansible/ansible/pull/81880), which is a worrying amount of time for the collection developers to not have noticed that their collection is completely broken.
