<commit_before># Jidoteki Admin tasks

- name: Create 'admin' directory structure
  file: >
    state=directory
    path={{ item }}
    owner=root
    group=root
    mode=0755
  with_items:
    - "{{ admin_path }}/bin"
    - "{{ admin_path }}/etc"
    - "{{ admin_path }}/tmp"
    - "{{ admin_path }}/log"
  tags:
    - admin

- name: Copy the secure keyfile used to decrypt software update packages
  copy: >
    src="{{ keypair_path }}/updates.key"
    dest="{{ admin_path }}/etc/updates.key"
    owner=root
    group=admin
    mode=0640
  tags:
    - admin

- name: Create the initial version.txt file
  lineinfile: >
    state=present
    create=yes
    line="{{ release_version }}"
    dest="{{ admin_path }}/etc/version.txt"
  tags:
    - admin
    - version

- name: Set the proper file permissions on the version.txt file
  file: >
    state=file
    path="{{ admin_path }}/etc/version.txt"
    owner=root
    group=root
    mode=0644
  tags:
    - admin

- name: Create admin directories only writeable by root
  file: >
    state=directory
    path={{ item }}
    owner=root
    group=admin
    mode=0750
    recurse=no
  with_items:
    - "{{ admin_path }}/home"
    - "{{ admin_path }}/home/.ssh"
    - "{{ admin_path }}/home/sftp"
  tags:
    - admin

- name: Add 'admin/sftpadmin' user's public SSH key
  authorized_key: >
    user=admin
    key="{{ item }}"
    key_options='no-pty,command="{{ admin_path }}/bin/wrapper.sh"'
    manage_dir=no
  with_file:
    - "{{ keypair_path }}/admin_ssh_key.pub"
  tags:
    - admin

- name: Ensure 'admin/sftpadmin' user can't modify the authorized_keys file
  file: >
    state=file
    path="{{ admin_path }}/home/.ssh/authorized_keys"
    owner=root
    group=admin
    mode=0640
  tags:
    - admin

- name: Create admin sftp uploads directory
  file: >
    state=directory
    path={{ item }}
    owner=sftpadmin
    group=admin
    mode=0770
    recurse=no
  with_items:
    - "{{ admin_path }}/home/sftp/uploads"
  tags:
    - admin

- name: Add SSH admin management scripts
  template: >
    src={{ item }}.j2
    dest="{{ admin_path }}/bin/{{ item }}"
    owner=root
    group=root
    mode=0755
  with_items:
    - update_vm.sh
    - update_license.sh
    - update_settings.sh
    - update_token.sh
    - update_logs.sh
  tags:
    - admin
    - updated

- name: Add SSH admin wrapper script
  copy: >
    src=wrapper.sh
    dest="{{ admin_path }}/bin/wrapper.sh"
    owner=root
    group=admin
    mode=0750
  tags:
    - admin
    - updated

- include: repos_debian.yml
- include: repos_centos.yml<commit_msg>SSH Admin wrapper script renamed<commit_after># Jidoteki Admin tasks

- name: Create 'admin' directory structure
  file: >
    state=directory
    path={{ item }}
    owner=root
    group=root
    mode=0755
  with_items:
    - "{{ admin_path }}/bin"
    - "{{ admin_path }}/etc"
    - "{{ admin_path }}/tmp"
    - "{{ admin_path }}/log"
  tags:
    - admin

- name: Copy the secure keyfile used to decrypt software update packages
  copy: >
    src="{{ keypair_path }}/updates.key"
    dest="{{ admin_path }}/etc/updates.key"
    owner=root
    group=admin
    mode=0640
  tags:
    - admin

- name: Create the initial version.txt file
  lineinfile: >
    state=present
    create=yes
    line="{{ release_version }}"
    dest="{{ admin_path }}/etc/version.txt"
  tags:
    - admin
    - version

- name: Set the proper file permissions on the version.txt file
  file: >
    state=file
    path="{{ admin_path }}/etc/version.txt"
    owner=root
    group=root
    mode=0644
  tags:
    - admin

- name: Create admin directories only writeable by root
  file: >
    state=directory
    path={{ item }}
    owner=root
    group=admin
    mode=0750
    recurse=no
  with_items:
    - "{{ admin_path }}/home"
    - "{{ admin_path }}/home/.ssh"
    - "{{ admin_path }}/home/sftp"
  tags:
    - admin

- name: Add 'admin/sftpadmin' user's public SSH key
  authorized_key: >
    user=admin
    key="{{ item }}"
    key_options='no-pty,command="{{ admin_path }}/bin/wrapper.sh"'
    manage_dir=no
  with_file:
    - "{{ keypair_path }}/admin_ssh_key.pub"
  tags:
    - admin

- name: Ensure 'admin/sftpadmin' user can't modify the authorized_keys file
  file: >
    state=file
    path="{{ admin_path }}/home/.ssh/authorized_keys"
    owner=root
    group=admin
    mode=0640
  tags:
    - admin

- name: Create admin sftp uploads directory
  file: >
    state=directory
    path={{ item }}
    owner=sftpadmin
    group=admin
    mode=0770
    recurse=no
  with_items:
    - "{{ admin_path }}/home/sftp/uploads"
  tags:
    - admin

- name: Add SSH admin management scripts
  template: >
    src={{ item }}.j2
    dest="{{ admin_path }}/bin/{{ item }}"
    owner=root
    group=root
    mode=0755
  with_items:
    - update_vm.sh
    - update_license.sh
    - update_settings.sh
    - update_token.sh
    - update_logs.sh
  tags:
    - admin
    - updated

- name: Add SSH admin wrapper script
  copy: >
    src=wrapper.sh.j2
    dest="{{ admin_path }}/bin/wrapper.sh"
    owner=root
    group=admin
    mode=0750
  tags:
    - admin
    - updated

- include: repos_debian.yml
- include: repos_centos.yml
{'fraction_non_alphanumeric': 0.13089713843774167, 'fraction_numerical': 0.012954369682907967, 'mean_word_length': 2.481157469717362, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '2943559', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1806, 'n_words': 437}