---

- name: 'apply setup to {{ host | default("all") }}'
  hosts: '{{ host | default("all") }}'
  serial: "{{ serial_number|default(25) }}"
  become: false

  pre_tasks:
    - name: "Check if ansible version is at least {{ ansible_minimal_version }}"
      assert:
        that:
          - ansible_version.string is version(ansible_minimal_version, ">=")
        msg: "The ansible version has to be at least {{ ansible_minimal_version }}"

    - name: "Import autodiscover pre-tasks"
      import_tasks: tasks/autodiscover_pre_tasks.yml
      become: false
      tags:
        - always

    - name: "Variable <ansible_distribution>"
      debug:
        msg: "{{ ansible_distribution }}"
      delegate_to: 127.0.0.1

    - name: "Variable <group_names>"
      debug:
        msg: "{{ group_names }}"
      delegate_to: 127.0.0.1

    - name: "Printing ip addresses for {{ inventory_hostname }}"
      debug:
        msg: "{{ stage_server_ip }} / {{ stage_private_server_ip }}"
      delegate_to: 127.0.0.1

    - name: "Printing stage_server_infos"
      debug:
        msg: "{{ stage_server_infos }}"
      delegate_to: 127.0.0.1
