tuxinvader.launchpad.wait_interactive_login (1.0.7) — module

Perform the OAUTH authorization process for using a launchpad with a user account

| "added in version" 1.0.0 of tuxinvader.launchpad"

Authors: Mark Boddington (@TuxInvader)

Install collection

Install with ansible-galaxy collection install tuxinvader.launchpad:==1.0.7


Add to requirements.yml

  collections:
    - name: tuxinvader.launchpad
      version: 1.0.7

Description

This task should be called in a loop after `start_interactive_login` and retry until \ the user has authorized the request token. The task will return LP_ACCESS_TOKEN and \ LP_ACCESS_SECRET which can then be used as environment vars for authenticated Launchpad access.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Start the interactive login process by generating a request token and presenting url to user
- name: Start Interactive login
  start_interactive_login:
  register: login_start
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Prompt user
  debug:
    msg: "Please open this URL to authorize Ansible access: {{ login_start.authorization_url }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Wait for the token exchange to be completed by the user, and return the OAUTH tokens
- name: Wait for auth to complete
  wait_interactive_login:
    credentials: "{{ login_start.credentials | to_json }}"
  delay: 5
  retries: 12
  register: login_done
  until: login_done.LP_ACCESS_TOKEN is defined
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Display Tokens
  debug:
    msg: "Please Add these to your environment: LP_ACCESS_TOKEN={{ login_done.LP_ACCESS_TOKEN }}   LP_ACCESS_SECRET={{ login_done.LP_ACCESS_SECRET }}"

Inputs

    
credentials:
    description: The OAUTH request token output from start_interactive_login
    required: true
    type: str

Outputs

LP_ACCESS_SECRET:
  description: The Access token secret for authenticated LP access. Add to your environment.
  returned: changed
  sample: cFmGdmkXCTjRdfc5pRVvd8933bv8R7pmSkbXbmpPC2Ddkasjdklagp5gK32xK9VlxqPmRcRcnvJskKj7xN
  type: str
LP_ACCESS_TOKEN:
  description: The Access token for authenticated LP access. Add to your environment.
  returned: changed
  sample: TWGbLbMX892jdbffzQF5
  type: str