ANSIBLE="$ENVS/ansible/bin/ansible-playbook"
TASKFILE="$HOME/dot.$HOSTNAME.yaml"
LINKFILES="$HOME/dotfiles/files"
+INSTALLS="$HOME/dotfiles/install"
read -d '' EMPTY_TASKFILE << EOF
---
read -d '' LINK_THIS_FILE << EOF
- - name: Create a symbolic link
+ - name: symlink $2
ansible.builtin.file:
src: "$LINKFILES/$2"
dest: "$HOME/.$2"
echo " $LINK_THIS_FILE" >> $TASKFILE
echo "$2 added to symlinks in $TASKFILE"
- echo "Run `dot apply` to create all configured symlinks"
+ echo "Run 'dot apply' to create all configured symlinks"
fi
+
+if [ "$1" == "apply" ]; then
+ if [[ ! -f "$TASKFILE" ]]; then
+ echo "$TASKFILE is missing. Run 'dot setup'"
+ exit 1
+ fi
+ $ANSIBLE $TASKFILE
+fi
+
+if [ "$1" == "install" ]; then
+ if [ ! -n "$2" ]; then
+ echo "Can install:"
+ cd $INSTALLS
+ ls -p | grep -v /
+ exit 1
+ fi
+ $INSTALLS/$2
+fi
+
+