This tool helps migrate existing Ansible playbooks from the legacy citrix.adc collection to the new netscaler.adc collection format.
The migration tool converts YAML playbooks that use:
- Legacy
citrix.adcmodules citrix_adc_nitro_requestgeneric module
Into playbooks that use the new netscaler.adc collection modules.
- Module Mapping: Automatically maps legacy module names to new collection modules
- State Conversion: Converts NITRO request operations to appropriate state values
- Credential Handling: Preserves and converts authentication parameters
- YAML Structure Preservation: Maintains playbook structure, variables, and task organization
python3 convert_yaml.py -i input_playbook.yaml -o output_playbook.yaml-i, --input: (Required) Path to the input YAML playbook-o, --output: (Optional) Path for the output file. Defaults tooutput.yaml-v, --verbose: (Optional) Enable verbose mode
python convert_yaml.py -i legacy_playbook.yml -o migrated_playbook.ymlThe tool uses resource_map to convert legacy module names to new collection modules:
citrix.adc.<resource_name>→netscaler.adc.<resource_name><resource_name>→netscaler.adc.<resource_name>citrix_adc_nitro_request→netscaler.adc.<resource_name>
Converts citrix_adc_nitro_request tasks to specific resource modules:
Before:
- name: Configure LB vserver
citrix_adc_nitro_request:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
operation: present
resource: lbvserver
name: my_lb_vserver
attributes:
servicetype: HTTP
ipv46: 10.10.10.10
port: 80After:
- name: Configure LB vserver
netscaler.adc.lbvserver:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
state: present
name: my_lb_vserver
servicetype: HTTP
ipv46: 10.10.10.10
port: 80Converts citrix.adc.<resource_name> to netscaler.adc.<resource_name>
Before:
---
- name: create server
delegate_to: localhost
citrix_adc_nitro_request:
operation: add
resource: server
name: test-server-1
attributes:
name: test-server-1
ipaddress: 10.10.10.10After:
- name: Configure LB vserver
netscaler.adc.lbvserver:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
state: present
name: my_lb_vserver
servicetype: HTTP
ipv46: 10.10.10.10
port: 80add,update→presentdelete→absentaction→ Uses the action value from the task
convert_yaml.py: Main conversion scriptresourcelist.py: Containsresource_mapandstate_mapmappings
- Python 3.x
- PyYAML
pip install pyyamlThe tool supports various YAML input formats:
- Single playbook dictionary
- List of tasks
The tool generates a properly formatted YAML playbook with:
- Converted module names
- Preserved task names and structure
- Proper indentation and formatting
- Resource not found: Check if the resource type exists in
resource_map - Missing name field: Ensure the original task has a
nameparameter for NITRO requests - Authentication errors: Verify credential parameters are correctly set
The tool provides console output showing:
- Module mappings being applied
- NITRO request processing details
- Tasks being converted
To add support for new modules:
- Update
resource_mapinresourcelist.py - Add appropriate state mappings if needed
- Test with sample playbooks
As Red Hat Ansible Certified Content, this collection is entitled to support through the Ansible Automation Platform (AAP) using the Create issue button on the top right corner. If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, we strongly encourage engaging with the NetScaler and Ansible community. You can contribute to the collection or seek assistance via the NetScaler's Official GitHub Repository or connect with other Ansible users on the Ansible Forum.