<commit_before>---

- name: Get next available User ID
  shell: "echo $(dscl . -list /Users uid | awk '{print $2}' | sort -ug  | tail -1) + 1 | bc"
  register: uid

- name: Use a uuid for the script name
  shell: "date | shasum -a 384 | awk '{print $1}'" 
  register: script_name

- set_fact: 'newuser_sh={{ script_name.stdout }}.sh'

- name: Create user script
  template: src=newuser.j2 dest=/tmp/{{ newuser_sh }} mode=0755

- name: Make a user!
  shell: /tmp/{{ newuser_sh }} creates=/Users/{{ username }}

- name: Remove the newuser script
  file: path=/tmp/{{ newuser_sh }} state=absent

- name: Prepend /usr/local/bin to $PATH in .profile
  lineinfile:
    dest=/Users/{{ username }}/.profile
    state=present
    regexp="^export\s+PATH=/usr/local/bin:\\$PATH"
    insertafter=EOF
    line="export
    PATH=/usr/local/bin:$PATH"
    create=yes<commit_msg>Create tempfiles with mktemp. This was the last one, closes #10<commit_after>---

- name: Get next available User ID
  shell: "echo $(dscl . -list /Users uid | awk '{print $2}' | sort -ug  | tail -1) + 1 | bc"
  register: uid

- command: mktemp -t create_{{ username }}-XXXXX
  register: newuser_script

- name: Create user script
  template: src=newuser.j2 dest={{ newuser_script.stdout }} mode=0755

- name: Make a user!
  shell: "{{ newuser_script.stdout }} creates=/Users/{{ username }}"

- name: Remove the newuser script
  file: path={{ newuser_script.stdout }} state=absent

- name: Prepend /usr/local/bin to $PATH in .profile
  lineinfile:
    dest=/Users/{{ username }}/.profile
    state=present
    regexp="^export\s+PATH=/usr/local/bin:\\$PATH"
    insertafter=EOF
    line="export
    PATH=/usr/local/bin:$PATH"
    create=yes
{'fraction_non_alphanumeric': 0.15520282186948853, 'fraction_numerical': 0.012933568489124045, 'mean_word_length': 3.297979797979798, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4106921', 'n_tokens_mistral': 620, 'n_tokens_neox': 588, 'n_words': 174}