<commit_before>---

## Client software packages (((

- name: Load package list presets provided by this role
  include_vars: '{{ item }}.yml'
  with_flattened:
    - 'packages_preset_ypid'
    - 'packages_preset_ypid_absent'
  tags: [ 'role::linuxmuster_net_client:pkgs' ]

- name: Install client software packages
  apt:
    name: '{{ item }}'
    state: 'latest'
  when: item|d()
  with_flattened:
    - '{{ linuxmuster_net_client__packages_preset | list }}'
    - '{{ linuxmuster_net_client__packages        | list }}'
    - '{{ linuxmuster_net_client__group_packages  | list }}'
  tags: [ 'role::linuxmuster_net_client:pkgs' ]

- name: Remove client software packages
  apt:
    name: '{{ item }}'
    state: 'absent'
  when: item|d()
  with_flattened:
    - '{{ linuxmuster_net_client__packages_preset_absent | list }}'
    - '{{ linuxmuster_net_client__packages_absent        | list }}'
    - '{{ linuxmuster_net_client__group_packages_absent  | list }}'
  tags: [ 'role::linuxmuster_net_client:pkgs' ]

## )))

## Manage local user for offline usage (((

- name: Install the sync_localuser script
  template:
    dest:  '{{ item.dest }}'
    src:   '{{ item.src   | d(item.dest) }}.j2'
    mode:  '{{ item.mode  | d("0744") }}'
    owner: '{{ item.owner | d("root") }}'
    group: '{{ item.group | d("root") }}'
    validate: '{{ item.validate | d(omit) }}'
  when: (item.when|d(True) | bool != False)
  with_items:
    - file: '{{ linuxmuster_net_client__local_user_script_filepath }}'
      src: '/usr/local/bin/sync_localuser'
      when: '{{ linuxmuster_net_client__local_user_enabled | bool }}'

- name: Schedule the sync_localuser script for execution during reboots
  lineinfile:
    dest: '/etc/rc.local'
    regexp: '^{{ linuxmuster_net_client__local_user_script_filepath }}'
    line: '{{ linuxmuster_net_client__local_user_script_filepath }} 1> /var/log/sync_localuser.log'
    insertbefore: '^exit 0'
  when: (linuxmuster_net_client__local_user_enabled | bool)

- name: Disable the sync_localuser script during reboots
  lineinfile:
    dest: '/etc/rc.local'
    line: '{{ linuxmuster_net_client__local_user_script_filepath }}'
    state: 'absent'
  when: not (linuxmuster_net_client__local_user_enabled | bool)

## )))

## Linuxmuster.net client configuration (((

- name: Copy custom configuration files to the client
  synchronize:
    src: './etc/'
    dest: '/etc'
    recursive: True
    links: True
    # set_remote_user: no
  when: (linuxmuster_net_client__copy_custom_config_etc | bool)

- name: Copy custom configuration files to the client and delete all other files
  synchronize:
    src: '.{{ item }}/'
    dest: '{{ item }}'
    recursive: True
    links: True
    delete: True
    set_remote_user: no
  when: item|d()
  with_flattened:
    - '{{ linuxmuster_net_client__etc_delete_sync }}'

## )))

## Client auto shutdown (((

## FIXME: Remove when https://github.com/linuxmuster/linuxmuster-client-extras/pull/3 is being rolled out to the clients.
- name: Make sure the fixed shutdown script is available
  copy:
    src: 'usr/bin/check-shutdown'
    dest: '/usr/bin/check-shutdown'
    mode: '0755'
    owner: 'root'<commit_msg>Ensure synchronize is called with verify_host: True<commit_after>---

## Client software packages (((

- name: Load package list presets provided by this role
  include_vars: '{{ item }}.yml'
  with_flattened:
    - 'packages_preset_ypid'
    - 'packages_preset_ypid_absent'
  tags: [ 'role::linuxmuster_net_client:pkgs' ]

- name: Install client software packages
  apt:
    name: '{{ item }}'
    state: 'latest'
  when: item|d()
  with_flattened:
    - '{{ linuxmuster_net_client__packages_preset | list }}'
    - '{{ linuxmuster_net_client__packages        | list }}'
    - '{{ linuxmuster_net_client__group_packages  | list }}'
  tags: [ 'role::linuxmuster_net_client:pkgs' ]

- name: Remove client software packages
  apt:
    name: '{{ item }}'
    state: 'absent'
  when: item|d()
  with_flattened:
    - '{{ linuxmuster_net_client__packages_preset_absent | list }}'
    - '{{ linuxmuster_net_client__packages_absent        | list }}'
    - '{{ linuxmuster_net_client__group_packages_absent  | list }}'
  tags: [ 'role::linuxmuster_net_client:pkgs' ]

## )))

## Manage local user for offline usage (((

- name: Install the sync_localuser script
  template:
    dest:  '{{ item.dest }}'
    src:   '{{ item.src   | d(item.dest) }}.j2'
    mode:  '{{ item.mode  | d("0744") }}'
    owner: '{{ item.owner | d("root") }}'
    group: '{{ item.group | d("root") }}'
    validate: '{{ item.validate | d(omit) }}'
  when: (item.when|d(True) | bool != False)
  with_items:
    - file: '{{ linuxmuster_net_client__local_user_script_filepath }}'
      src: '/usr/local/bin/sync_localuser'
      when: '{{ linuxmuster_net_client__local_user_enabled | bool }}'

- name: Schedule the sync_localuser script for execution during reboots
  lineinfile:
    dest: '/etc/rc.local'
    regexp: '^{{ linuxmuster_net_client__local_user_script_filepath }}'
    line: '{{ linuxmuster_net_client__local_user_script_filepath }} 1> /var/log/sync_localuser.log'
    insertbefore: '^exit 0'
  when: (linuxmuster_net_client__local_user_enabled | bool)

- name: Disable the sync_localuser script during reboots
  lineinfile:
    dest: '/etc/rc.local'
    line: '{{ linuxmuster_net_client__local_user_script_filepath }}'
    state: 'absent'
  when: not (linuxmuster_net_client__local_user_enabled | bool)

## )))

## Linuxmuster.net client configuration (((

- name: Copy custom configuration files to the client
  synchronize:
    src: './etc/'
    dest: '/etc'
    recursive: True
    links: True
    # set_remote_user: no
    verify_host: True
  when: (linuxmuster_net_client__copy_custom_config_etc | bool)

- name: Copy custom configuration files to the client and delete all other files
  synchronize:
    src: '.{{ item }}/'
    dest: '{{ item }}'
    recursive: True
    links: True
    delete: True
    set_remote_user: no
    verify_host: True
  when: item|d()
  with_flattened:
    - '{{ linuxmuster_net_client__etc_delete_sync }}'

## )))

## Client auto shutdown (((

## FIXME: Remove when https://github.com/linuxmuster/linuxmuster-client-extras/pull/3 is being rolled out to the clients.
- name: Make sure the fixed shutdown script is available
  copy:
    src: 'usr/bin/check-shutdown'
    dest: '/usr/bin/check-shutdown'
    mode: '0755'
    owner: 'root'
{'fraction_non_alphanumeric': 0.13361396944184598, 'fraction_numerical': 0.0037418147801683817, 'mean_word_length': 3.706529713866471, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '3572119', 'n_tokens_mistral': 2272, 'n_tokens_neox': 2226, 'n_words': 477}