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

Disassociate hosts from groups function in ansible.controller.group module

XMLWordPrintable

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

      None

      Show
      None
    • False

      Feature Overview

      We are receiving requests from customers regarding Case 03367506. 

      Background, and strategic fit

      In Case 03367506, the customer needs to disassociate hosts from groups frequently so they need that function in ansible.controller.group module. 

      Currently, we have a workaround which uses ansible.builtin.uri module. The following is an example.

      - name: Example of disassociate hosts from groups
        ansible.builtin.uri:
          url: https://<CONTROLLER_URL>/api/v2/groups/N/hosts/ 
          method: POST
          url_username: USERNAME
          url_password: PASSWORD
          force_basic_auth: yes
          status_code: 204
          headers:
            Content-Type: application/json
          body: "{{ lookup('ansible.builtin.file','issue.json') }}" 
          body_format: json
          validate_certs: false
      
      

      issue.json

      {"disassociate": "1", "id": N}  # N is a host ID

      But if we need to disassociate multiple hosts from groups, it needs to implement the complicated playbook.

      I'm assuming the new feature is like the following:

      - name: Example of disassociate hosts from groups   
        ansible.controller.group:
          inventory: "inventory test"
          name: "test group"      
          disassociate_hosts: # <<=== new feature 
            - test1
            - test2
          validate_certs: no
              
          

       

       

       

       

              bcoursen@redhat.com Brian Coursen
              rhn-support-loh Lisa OH
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: