# Note: need to specify extra_vars, providing ansible_ssh_user, and ansible_ssh_pass

- name: Set up IPA Client
  hosts: tag_ipa_client
  become: yes
  collections:
    - freeipa.ansible_freeipa
  pre_tasks:
    - name: Set hostname
      hostname:
        name: "{{inventory_hostname}}"

    - name: Attach subscriptions
      command: '/usr/bin/subscription-manager attach'
      register: result
      changed_when:
        - '"All installed products are covered by valid entitlements. No need to update subscriptions at this time." not in result.stdout'
      when: ansible_distribution == "RedHat"


  roles:
    - role: debian-freeipa-client
      when: ansible_os_family == "Debian"
    - role: ipaclient
      state: present
      when: ansible_os_family == "RedHat"

- name: Set up Basic Lab Packages
  hosts: all
  become: yes
  roles:
    - role: toal-common
