Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```yaml
- ---
- - name: Space API Example
- hosts: all
- connection: local
- gather_facts: no
- vars:
- space_auth_user: "super"
- space_auth_password: "Juniper123!@#"
- space_api_uri: "http://192.168.58.201/api"
- #space_api_uri: "http://127.0.0.1:9999/api"
- space_api_login_uri : "space/user-management/login"
- ssl_verification: no
- tasks:
- - name: Login to Junos Space
- uri:
- url: "{{ space_api_uri}}/{{space_api_login_uri}}"
- method: POST
- force_basic: yes
- status_code: 302, 200
- validate_certs: no
- follow_redirects: all
- user: "{{ space_auth_user }}"
- password: "{{ space_auth_password }}"
- register: login
- - name: Print login results
- debug:
- var: login
- verbosity: 4
- - name: Get all logged in users
- uri:
- url: "{{ space_api_uri}}/space/user-management/active-user-sessions"
- method: GET
- follow_redirects: all
- headers:
- #Accept: application/vnd.net.juniper.space.user-management.active-user-sessions+json;version=1;g=0.01
- Cookie: "{{ login.set_cookie }}"
- validate_certs: "{{ ssl_verification }}"
- register: result
- - name: print results
- debug:
- var: "{{ result.json }}"
- verbosity: 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement