<commit_before>---
# Perform installation with the ipa-client-install command
- name: Assert required variables
  assert:
    that:
      - freeipa_client__server is defined
      - freeipa_client__domain is defined
      - freeipa_client__enroll_user is defined
      - freeipaclient_enroll_pass is defined
  tags: ['freeipa-client', 'client-install']

- name: Check if host is enrolled
  register: freeipaclient_ipaconf
  check_mode: no
  stat:
    path: /etc/ipa/default.conf
  tags: ['freeipa-client', 'client-install']
  
- name: Enroll host in domain
  become: true
  when: not freeipaclient_ipaconf.stat.exists
  command: >
    {{ freeipa_client__install_command }}
    {{'--hostname=' + freeipa_client__hostname if freeipa_client__hostname is defined else ''}}
    --server={{ freeipa_client__server }}
    --domain={{ freeipa_client__domain }}
    --principal={{ freeipa_client__enroll_user }}
    --password={{ <PASSWORD>client__enroll_pass }}
    --ssh-trust-dns
    --mkhomedir
    {{ '--enable-dns-updates' if freeipa_client__enable_dns_updates else ''}}
    --unattended
    {{ '--all-ip-addresses' if freeipa_client__all_ip_addresses else ''}}
    {{ '--no-ntp' if not freeipa_client__enable_ntp else ''}}
    {{ '--force-join' if freeipa_client__force_join else ''}}
  tags: ['freeipa-client', 'client-install']<commit_msg>Move assetion after the check for already enrolled<commit_after>---
# Perform installation with the ipa-client-install command
- name: Check if host is enrolled
  register: freeipaclient_ipaconf
  check_mode: no
  stat:
    path: /etc/ipa/default.conf
  tags: ['freeipa-client', 'client-install']

- name: Assert required variables
  assert:
    that:
      - freeipa_client__server is defined
      - freeipa_client__domain is defined
      - freeipa_client__enroll_user is defined
      - freeipaclient_enroll_pass is defined
  when: not freeipaclient_ipaconf.stat.exists
  tags: ['freeipa-client', 'client-install']

- name: Enroll host in domain
  become: true
  when: not freeipaclient_ipaconf.stat.exists
  command: >
    {{ freeipa_client__install_command }}
    {{'--hostname=' + freeipa_client__hostname if freeipa_client__hostname is defined else ''}}
    --server={{ freeipa_client__server }}
    --domain={{ freeipa_client__domain }}
    --principal={{ freeipa_client__enroll_user }}
    --password={{ freeipa_client__enroll_pass }}
    --ssh-trust-dns
    --mkhomedir
    {{ '--enable-dns-updates' if freeipa_client__enable_dns_updates else ''}}
    --unattended
    {{ '--all-ip-addresses' if freeipa_client__all_ip_addresses else ''}}
    {{ '--no-ntp' if not freeipa_client__enable_ntp else ''}}
    {{ '--force-join' if freeipa_client__force_join else ''}}
  tags: ['freeipa-client', 'client-install']
{'fraction_non_alphanumeric': 0.12005803409503082, 'fraction_numerical': 0.0, 'mean_word_length': 3.779896013864818, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5737348', 'n_tokens_mistral': 897, 'n_tokens_neox': 940, 'n_words': 197}