huaweidatacom / huaweidatacom.ac / 1.0.0 / module / ac_token Get Token from HUAWEI iMaster NCE-Fabric Controller. Authors: ZhiwenZhang (@maomao1995)huaweidatacom.ac.ac_token (1.0.0) — module
Install with ansible-galaxy collection install huaweidatacom.ac:==1.0.0
collections: - name: huaweidatacom.ac version: 1.0.0
Get Tenant from HUAWEI iMaster NCE-Fabric Controller(AC).
- name: Get Token hosts: localhost serial: True vars_prompt: - name: "userName" prompt: "Please input userName " private: no - name: "password" prompt: "Please input password " echo: no tasks: - name: delete old access token tags: always vars: token_info: token: "{{lookup('file','/tmp/ansible-temp')}}" uri: url: 'https://{{north_ip}}:{{north_port}}/controller/v2/tokens' method: DELETE body: '{{token_info}}' body_format: json validate_certs: False headers: Accept: application/json ignore_errors: yes - name: get access token tags: always vars: auth_user: userName: '{{userName}}' password: '{{password}}' uri: url: 'https://{{north_ip}}:{{north_port}}/controller/v2/tokens' method: POST body: '{{auth_user}}' body_format: json validate_certs: False return_content: yes headers: Accept: application/json status_code: 200 register: token_result - local_action: copy content='{{token_result.json.data.token_id}}' dest="/tmp/ansible-temp"
- name: Delete Token hosts: localhost serial: True tasks: - name: delete access token tags: always vars: token_info: token: "{{lookup('file','/tmp/ansible-temp')}}" uri: url: 'https://{{north_ip}}:{{north_port}}/controller/v2/tokens' method: DELETE body: '{{token_info}}' body_format: json validate_certs: False return_content: yes headers: Accept: application/json status_code: 200 register: token_result - name: response from delete access token tags: always debug: msg: "{{token_result.json}}"
password: description: - AC User password. userName: description: - AC User name.