<commit_before>#!/bin/bash

# Install Ansible

set -e

# Requires apt
if ! which apt; then
  echo "*** apt does not exist ***"
  echo "*** minimum requirements not met ***"
fi

cd $(dirname $0)


# Ubuntu 16.x
if grep "Ubuntu 16" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt purge -y appstream
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y python-software-properties && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi


# Ubuntu 17.x
if grep "Ubuntu 17" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt purge -y appstream
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y python-software-properties && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi


# Ubuntu 18.x
if grep "Ubuntu 18" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi


# Ubuntu 19.x
if grep "Ubuntu 19" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi

# Ubuntu 20.x
if grep "Ubuntu 20" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt install -y ansible
  fi
fi

# Debian
if grep Debian /etc/issue >/dev/null; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt update && \
    apt install -y ansible
  fi
fi

# Best effort
if grep Ubuntu /etc/issue >/dev/null; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi

if ! which ansible-playbook; then
  echo "** ansible not able to be installed **"
  echo "** unknown linux **"
  cat /etc/issue
  exit 1
fi

if [ ! -d ".git" ]; then
  git clone https://github.com/TheShellLand/antsable

  # Run playbook
  if [ ! "$1" == "" ]; then
    set -x
    ansible-playbook -i inventory.yaml "$@"
  fi

else
  # Create inventory.yaml<commit_msg>make antsable folder owned by user running sudo<commit_after>#!/bin/bash

# Install Ansible

set -e

# Requires apt
if ! which apt; then
  echo "*** apt does not exist ***"
  echo "*** minimum requirements not met ***"
fi

cd $(dirname $0)


# Ubuntu 16.x
if grep "Ubuntu 16" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt purge -y appstream
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y python-software-properties && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi


# Ubuntu 17.x
if grep "Ubuntu 17" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt purge -y appstream
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y python-software-properties && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi


# Ubuntu 18.x
if grep "Ubuntu 18" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi


# Ubuntu 19.x
if grep "Ubuntu 19" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi

# Ubuntu 20.x
if grep "Ubuntu 20" /etc/issue; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt install -y ansible
  fi
fi

# Debian
if grep Debian /etc/issue >/dev/null; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt update && \
    apt install -y ansible
  fi
fi

# Best effort
if grep Ubuntu /etc/issue >/dev/null; then

  if ! which ansible; then
    echo "Installing ansible"
    apt update && \
    apt install -y git vim curl && \
    apt install -y software-properties-common && \
    apt install -y apt-transport-https && \
    apt-add-repository -y 'ppa:ansible/ansible' && \
    apt update && \
    apt install -y ansible
  fi
fi

if ! which ansible-playbook; then
  echo "** ansible not able to be installed **"
  echo "** unknown linux **"
  cat /etc/issue
  exit 1
fi

if [ ! -d ".git" ]; then
  git clone https://github.com/TheShellLand/antsable
  chown -R $SUDO_USER antsable

  # Run playbook
  if [ ! "$1" == "" ]; then
    set -x
    ansible-playbook -i inventory.yaml "$@"
  fi

else
  # Create inventory.yaml
{'fraction_non_alphanumeric': 0.11932434526576786, 'fraction_numerical': 0.0071284673795134045, 'mean_word_length': 2.3285198555956677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '281192', 'n_tokens_mistral': 2273, 'n_tokens_neox': 2095, 'n_words': 742}