---
- name: Set hostname
  hosts: ipa_server
  become: true
  gather_facts: true

  tasks:
    - name: Set hostname
      ansible.builtin.hostname:
        name: "{{ hostname }}"
      register: result

    - name: Print result
      ansible.builtin.debug:
        var: result
