Skip to content

fix issue when state: absent is used with existing_token#129

Open
l3acon wants to merge 1 commit intoansible:develfrom
l3acon:fix_existing_token_url
Open

fix issue when state: absent is used with existing_token#129
l3acon wants to merge 1 commit intoansible:develfrom
l3acon:fix_existing_token_url

Conversation

@l3acon
Copy link

@l3acon l3acon commented Feb 24, 2026

Description

  • What is being changed?
    token.py (ansible.platform.token module)
  • Why is this change needed?
    Address ansible.platform.token: existing tokens url bug #128
  • How does this change address the issue?
    When existing_token is provided but lacks a url key, extract the actual token data from the ansible_facts.aap_token path before passing it to delete_if_needed().

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test update
  • Refactoring (no functional changes)
  • Development environment change
  • Configuration change

Self-Review Checklist

  • I have performed a self-review of my code
  • I have added relevant comments to complex code sections
  • I have updated documentation where needed
  • I have considered the security impact of these changes
  • I have considered performance implications
  • I have thought about error handling and edge cases
  • I have tested the changes in my local environment

Testing Instructions

Prerequisites

Steps to Test

  1. Have AAP 2.6 instance and required variables for config as code (host, password..etc).
  2. Use simple playbook
---
- hosts: localhost
  gather_facts: false
  tasks:
    - name: Authenticate with AAP and obtain token
      ansible.platform.token:
      register: __aap_token

    - name: Revoke authentication token
      ansible.platform.token:
        existing_token: "{{ __aap_token }}"
        state: absent

  1. Run playbook.

Expected Results

The playbook should exit without error, the token should be created and removed successfully.

Additional Context

Required Actions

  • Requires documentation updates
  • Requires downstream repository changes
  • Requires infrastructure/deployment changes
  • Requires coordination with other teams
  • Blocked by PR/MR: #XXX

Screenshots/Logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant