Created
November 4, 2019 21:30
-
-
Save joe-at-cp/6f1099d0be2cfc41a222b77b24517d03 to your computer and use it in GitHub Desktop.
Ansible - CloudGuard Connect - Create Site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: localhost | |
| gather_facts: no | |
| vars: | |
| #Authentication | |
| CLIENT_ID: | |
| ACCESS_KEY: | |
| #Tunnel Info | |
| TUNNEL_NAME: AnsibleDemo | |
| TUNNEL_DESC: BuiltUsingAnsible | |
| TUNNEL_TYPE: ipsecPreSharedKey | |
| TUNNEL_PSK: zf3DE7NuWGOjIyizIwWYczWy1AUWwNRm | |
| #Local Router | |
| ROUTER_EXT_IP: "173.209.110.88" | |
| ROUTER_INT_NET: "10.20.30.0/24" | |
| ROUTER_PHYS_ADDR: What, Texas | |
| tasks: | |
| - name: CloudGuard Connect - Authentication | |
| uri: | |
| url: "https://cloudinfra-gw.portal.checkpoint.com/auth/external" | |
| method: POST | |
| headers: | |
| Content-Type: "application/json" | |
| Host: cloudinfra-gw.portal.checkpoint.com | |
| body_format: json | |
| body: | |
| clientId: "{{CLIENT_ID}}" | |
| accessKey: "{{ACCESS_KEY}}" | |
| register: cg_auth | |
| - name: CloudGuard Connect - Create VPN Tunnel | |
| uri: | |
| url: "https://cloudinfra-gw.portal.checkpoint.com/app/gwaas/graphql" | |
| method: POST | |
| headers: | |
| Content-Type: "application/json" | |
| Host: cloudinfra-gw.portal.checkpoint.com | |
| Authorization: "Bearer {{cg_auth.json.data.token}}" | |
| body_format: json | |
| body: | |
| query: "mutation addSite($data: AddSiteInput!) { addSite(data: $data)}" | |
| variables: | |
| data: | |
| name: "{{TUNNEL_NAME}}" | |
| description: "{{TUNNEL_DESC}}" | |
| routerExternalIPs: | |
| - "{{ROUTER_EXT_IP}}" | |
| routerSubnets: | |
| - "{{ROUTER_INT_NET}}" | |
| tunnelType: "{{TUNNEL_TYPE}}" | |
| preSharedKey: "{{TUNNEL_PSK}}" | |
| address: "{{ROUTER_PHYS_ADDR}}" | |
| register: cg_site |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment