Uploaded image for project: 'Ansible Automation Platform RFEs'
  1. Ansible Automation Platform RFEs
  2. AAPRFE-1655

Allow setting, editing and showing labels for schedules via WebUI

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 2.4, 2.5
    • controller
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      1. What is the nature and description of the request?

      Allow setting, editing and showing labels for schedules via WebUI.
      This is currently possible via API and the ansible.controller collection.

      To allow a quick evaluation, use the following playbook that creates labels in the Default Organization, then creates a schedule with the labels attached and finally shows that the labels are attached to the schedule:

      ---
      - hosts: 'localhost'
        gather_facts: false
        vars:
          controller_labels:
            - 'label-custom_label1'
            - 'label-custom_label2'
            - 'label-custom_label3'
          controller_organization: 'Default'
          controller_job_template: 'Demo Job Template'
          controller_schedule: 'schedule-reproducer'
          controller_host: 'https://controller.example.com'
          controller_username: !vault |
                $ANSIBLE_VAULT;1.1;AES256
          controller_password: !vault |
                $ANSIBLE_VAULT;1.1;AES256
      
          controller_verify_certs: true
      
        tasks:
          - name: 'Add labels to Organization: {{ controller_organization }}'
            ansible.controller.label:
              name: '{{ __t_label }}'
              organization: '{{ controller_organization }}'
              controller_host: '{{ controller_host }}'
              controller_username: '{{ controller_username }}'
              controller_password: '{{ controller_password }}'
              validate_certs: '{{ controller_verify_certs }}'
            loop: '{{ controller_labels }}'
            loop_control:
              loop_var: '__t_label'
      
          - name: 'Build a schedule for Demo Job Template'
            ansible.controller.schedule:
              name: '{{ controller_schedule }}'
              state: 'present'
              unified_job_template: '{{ controller_job_template }}'
              rrule: 'DTSTART:20191219T130551Z RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=1'
              labels: '{{ controller_labels }}'
              controller_host: '{{ controller_host }}'
              controller_username: '{{ controller_username }}'
              controller_password: '{{ controller_password }}'
              validate_certs: '{{ controller_verify_certs }}'
            register: 'result'
      
          - name: 'Ensure schedule ID has been returned'
            ansible.builtin.assert:
              that:
                - 'result.id'
      
          - name: 'Show labels of schedule'
            ansible.builtin.debug:
              msg:
                - >-
                  {{
                    lookup(
                      'ansible.controller.controller_api',
                      'schedules/' ~ result.id ~ '/labels',
                      host=controller_host,
                      username=controller_username,
                      password=controller_password,
                      verify_ssl=controller_verify_certs,
                      return_all=true
                    ) |
                    rejectattr('name', 'undefined') |
                    map(attribute='name')
                  }}
      

       

      It is also possible to browse the API directly by visiting:

      https://controller.example.com/api/v2/schedules/<schedule_id>/labels

       

      1. Why does the customer need this? (List the business requirements here)
      The customer is using a active/passive cluster defined with configuration as code (CaC) and is using the labels on schedules (again defined via code) to either enable or disable a schedule depending on which site is currently active.
      It would be helpful for users that are not the AAP team to see those labels without browsing the API manually.

      2. How would you like to achieve this? (List the functional requirements
      here)
      It should be possible to add, modify and set labels on schedules the same way as for other objects in AAP (e.g. job templates)

      1. List any affected known dependencies: Doc, UI etc..

      Product / engineering teams to determine

      1. Github Link if any
      None

              bcoursen@redhat.com Brian Coursen
              rhn-support-sscheib Steffen Scheib
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: