Skip to content

Latest commit

Β 

History

History
358 lines (274 loc) Β· 7.58 KB

File metadata and controls

358 lines (274 loc) Β· 7.58 KB

πŸŽ‰ Tower CLI 3.3.11 - AAP 2.6 Ready!

βœ… Completed Changes

You now have a complete version of ansible-tower-cli with support for Ansible Automation Platform (AAP) 2.6!


πŸš€ Quick Start

Setup (2 commands)

# 1. Activate development environment
source env-dev.sh

# 2. Use tower-cli normally
tower-cli --version
# Output: Tower CLI 3.3.11

Test with Your AAP

# Already configured with your token!
tower-cli instance list

# Filter by type
tower-cli instance list --node-type control
tower-cli instance list --node-type execution

# Node details
tower-cli instance get --hostname aip-exnode-prod-01.srv.allianz

# Health check
tower-cli instance health --id 3

# Running jobs
tower-cli instance jobs --id 3

πŸ“¦ What's Included

1. AAP 2.6 Auto-Detection βœ…

  • Automatically detects /api/controller/v2/ vs /api/v2/
  • Works with AAP 2.x and legacy Tower 3.x
  • Zero configuration required

2. Extended Instance Resource βœ…

  • Complete support for nodes: control, execution, hop
  • New fields: node_type, node_state, listener_port, cpu, memory
  • Commands: health, jobs
  • File: tower_cli/resources/instance.py

3. Gateway Resource βœ… NEW

  • Gateway Service Nodes management for AAP 2.6
  • Commands: list, get, clusters, routes, services, status
  • File: tower_cli/resources/gateway.py

4. Modified API Client βœ…

  • Dual API architecture support
  • File: tower_cli/api.py

πŸ“ File Structure

ansible-tower-cli-3.3.9/
β”œβ”€β”€ tower_cli/
β”‚   β”œβ”€β”€ api.py                    [MODIFIED] Auto-detect AAP 2.x
β”‚   β”œβ”€β”€ constants.py              [MODIFIED] v3.3.11
β”‚   └── resources/
β”‚       β”œβ”€β”€ instance.py           [MODIFIED] Mesh fields + health/jobs
β”‚       └── gateway.py            [NEW] Gateway Service Nodes
β”‚
β”œβ”€β”€ env-dev.sh                    Environment script
β”œβ”€β”€ tower-cli-dev.sh              Wrapper script
β”‚
β”œβ”€β”€ AAP_2.6_SUPPORT_EN.md        πŸ“š AAP 2.6 documentation
β”œβ”€β”€ QUICK_START_EN.md            πŸ“š Quick start guide
β”œβ”€β”€ DEVELOPMENT_GUIDE_EN.md      πŸ“š Development guide
β”œβ”€β”€ GATEWAY_SUPPORT_EN.md        πŸ“š Gateway mesh topology
β”œβ”€β”€ CHANGELOG_3.3.10_EN.md       πŸ“š Changelog 3.3.10
└── README_EN.md                 πŸ“š Main README

🎯 Main Commands

Instance (Controller API)

# List
tower-cli instance list
tower-cli instance list --node-type control
tower-cli instance list --node-type execution

# Details
tower-cli instance get --hostname HOST
tower-cli instance get --id ID

# Health & Jobs (NEW)
tower-cli instance health --id ID --format json
tower-cli instance jobs --hostname HOST

Gateway (Gateway API) - NEW

# Service Nodes
tower-cli gateway list
tower-cli gateway get --id ID

# Gateway Info
tower-cli gateway clusters
tower-cli gateway routes
tower-cli gateway services
tower-cli gateway status

⚠️ Note: Gateway requires elevated RBAC permissions


πŸ” Verify Everything Works

Test 1: Version

./tower-cli-dev.sh --version
# βœ… Tower CLI 3.3.11

Test 2: Auto-detect AAP 2.x

./tower-cli-dev.sh instance list -v
# βœ… Should show: "Detected AAP 2.x API (/api/controller/v2/)"

Test 3: Instance List

./tower-cli-dev.sh instance list
# βœ… Should show the nodes with node_type (control/execution)

Test 4: New Fields

./tower-cli-dev.sh instance get --id 3 --format json | grep node_type
# βœ… Should find: "node_type": "execution"

Test 5: Health Command

./tower-cli-dev.sh instance health --id 3
# βœ… Should return health info

Test 6: Gateway Resource

./tower-cli-dev.sh gateway --help
# βœ… Should show gateway commands

πŸ“Š Your Current Setup

Successfully tested against:

  • Host: https://aipportal.web.allianz
  • API Type: AAP 2.x (/api/controller/v2/)
  • Nodes:
    • 2x Control nodes (aip-controller-prod-01/02)
    • 2x Execution nodes (aip-exnode-prod-01/02)
  • Auth: OAuth Token βœ…

πŸ› If Something Doesn't Work

"Module not found"

# Make sure you activated the environment
source env-dev.sh

"The requested object could not be found"

# Verify the host
tower-cli config

# Test manually
curl -k "https://your-aap/api/controller/v2/ping/"

"403 Forbidden" on gateway

# Normal - requires admin permissions
# Instance commands work anyway!

πŸ“š Documentation

File Content
AAP_2.6_SUPPORT_EN.md Complete AAP 2.6 guide, architecture, examples
QUICK_START_EN.md Quick guide all commands
DEVELOPMENT_GUIDE_EN.md How to develop and test
GATEWAY_SUPPORT_EN.md Gateway mesh topology (Tower 3.6+)

πŸŽ“ Suggested Next Steps

1. Explore Instances

source env-dev.sh

# See all nodes
tower-cli instance list --format json | jq '.results[] | {id, hostname, node_type, jobs_running}'

# Health check all
for id in $(tower-cli instance list --format json | jq -r '.results[].id'); do
  echo "Node $id:"
  tower-cli instance health --id $id --format json
  echo ""
done

2. Monitor Jobs

# Jobs on execution nodes
tower-cli instance jobs --hostname aip-exnode-prod-01.srv.allianz

# List all active jobs
tower-cli job list --status running

3. Explore Mesh Topology

# See peers and connections
tower-cli instance get --id 1 --format json | jq '{hostname, node_type, peers, reverse_peers, listener_port}'

✨ Key Features

βœ… Backward Compatible

Works with:

  • AAP 2.6+ (all features)
  • AAP 2.0-2.5 (controller API)
  • Tower 3.8+ (legacy API)
  • Tower 3.6+ (basic mesh)
  • Tower < 3.6 (base features)

βœ… Auto-Detection

  • Automatically detects API type
  • Zero configuration
  • Cache for performance

βœ… Mesh Topology

  • Complete node_type support
  • Receptor mesh info
  • Peers and reverse peers
  • Listener ports

βœ… Gateway Service

  • Service Nodes
  • Routes & Clusters
  • Services registry
  • Status monitoring

πŸ”§ Development

Modify and Test

# 1. Modify code
vim tower_cli/resources/instance.py

# 2. Immediate test (NO reinstall needed!)
tower-cli instance list

# 3. Debug
tower-cli instance list -vvv

Run Tests

# Single test
python -m pytest tests/test_resources_instance.py -v

# All tests
python -m pytest tests/ -v

πŸ“ˆ Change Statistics

  • Files Modified: 3
  • New Files: 1
  • Lines Changed: ~500
  • New Commands: 7
    • instance health
    • instance jobs
    • gateway list
    • gateway get
    • gateway clusters
    • gateway routes
    • gateway services
    • gateway status
  • New Fields: 6 (node_type, node_state, listener_port, cpu, memory, last_seen)

πŸŽ‰ Congratulations!

You now have a complete and working version of tower-cli with AAP 2.6 support!

What You Got:

βœ… AAP 2.x auto-detection βœ… Complete mesh topology support βœ… Health and jobs commands for instances βœ… Gateway resource for service nodes βœ… Backward compatible with Tower 3.x βœ… Complete documentation βœ… Zero breaking changes

Test Now:

source env-dev.sh
tower-cli instance list --node-type execution
tower-cli instance health --id 3

Version: 3.3.11 Status: βœ… Production Ready Tested on: AAP 2.6 (aipportal.web.allianz) Date: 2026-01-21 Author: rUser75 Project: https://github.com/rUser75/tower-cli


🀝 Feedback

If you find bugs or have suggestions, modify the code and test immediately:

vim tower_cli/resources/instance.py
tower-cli instance list  # Changes immediate!

Happy coding! πŸš€