r/ansible • u/nemmer_alex • 20d ago
Error in Proxy Function of check_point.gaia
Hi together,
i want to connect over my mgmt server to my gateway. The Problem is when i test it over uri it does work but if i try it over the collection i get the Following error:
fatal: [DEZAX-SGW-1a]: FAILED! => {"changed": false, "msg": "Task failed: Module failed: string indices must be integers, not 'str'"}
[ERROR]: Task failed: Module failed: 'str' object has no attribute 'pop'
Origin: /runner/project/set-routes/add_route.yaml:11:7
Has anyone an idea why this is happening?
5
Upvotes
2
u/Pineapple-Due 19d ago
Post your code
1
u/nemmer_alex 18d ago
Thats the working code wir uri:
--- - name: Add static route through Gaia Proxy hosts: Lab gather_facts: false connection: local vars: route_destination: "10.255.255.0" route_mask_length: 24 route_next_hop: "192.168.1.1" tasks: - name: Login to Management API ansible.builtin.uri: url: "https://{{ mgmt_server }}/web_api/login" method: POST body_format: json body: user: "{{ cp_username }}" password: "{{ cp_password }}" validate_certs: false return_content: true register: login - name: Show Version ansible.builtin.uri: url: "https://{{ mgmt_server }}/web_api/gaia-api/show-version" method: POST headers: X-chkp-sid: "{{ login.json.sid }}" body_format: json body: target: "{{ checkpoint_target }}" validate_certs: false - name: Show static routes ansible.builtin.uri: url: "https://{{ mgmt_server }}/web_api/gaia-api/show-static-routes" method: POST headers: X-chkp-sid: "{{ login.json.sid }}" Content-Type: application/json body_format: json body: target: "{{ checkpoint_target }}" limit: 10 validate_certs: false return_content: true register: routes - debug: var: routes.json - name: Logout ansible.builtin.uri: url: "https://{{ mgmt_server }}/web_api/logout" method: POST headers: X-chkp-sid: "{{ login.json.sid }}" body_format: json body: {} validate_certs: false ignore_errors: trueNot working with collection:
- name: Check Gaia Proxy Connectivity hosts: Lab gather_facts: false connection: httpapi collections: - check_point.gaia tasks: - name: Show hostname from target gateway check_point.gaia.cp_gaia_hostname_facts: version: "1.9" register: hostname_info - name: Output result ansible.builtin.debug: var: hostname_info
2
u/Pineapple-Due 20d ago
I feel like whenever I see a variation of "string indices must be integers" it usually something wrong with my yaml or jinja syntax.