Rework home and add notes to sync.sh

This commit is contained in:
Austen Adler 2018-07-05 17:07:42 -04:00
parent e1d80ce73f
commit e0d6ead5f5
3 changed files with 28 additions and 12 deletions

View File

@ -1,7 +1,7 @@
---
- hosts: all
vars:
local_path: "{{ '~' | expanduser }}"
local_path: "{{ ansible_env.HOME }}"
disable_passwordauth: false
enable_passwordauth: false
private_repo: "git@austenwares.com:stonewareslord/private"
@ -12,3 +12,4 @@
- {role: secure, become: yes, tags: [secure]}
- {role: dns, tags: [dns]}
- {role: private, tags: [private]}
- {role: clean, tags: [clean]}

View File

@ -0,0 +1,11 @@
- name: Remove files
file:
path: "{{ local_path }}/{{ item.path }}"
state: absent
with_filetree: "skel/"
- name: Remove cloned repositories
file:
path: "{{ local_path }}/{{ item.path }}"
state: absent
loop:
- "{{ local_path }}/.fzf"

26
sync.sh
View File

@ -1,20 +1,24 @@
#!/bin/bash
# Examples
# Secure SSH
# ./sync.sh secure --ask-become-pass --tags
# Disable SSH password authentication
# ./sync.sh secure --extra-vars 'disable_passwordauth=true' --ask-become-pass
# Use 1.1.1.1 dns
# ./sync.sh dns --ask-become-pass
# Sync for root
# ./sync.sh default,vim --become --ask-become-pass
\cd "$(dirname $0)"
if [ -z "$1" ]; then
echo "Usage:"
echo "$0 TAG1,TAG2"
echo "$0 TAG1[,TAG2] [ANSIBLE-OPTS]"
echo "Available tags:"
echo "$(\ls roles | tr '\n' ' ')"
echo "Example: $0 default,vim"
exit 1
fi
ansible-playbook -i 'localhost,' main.yml --tags $1
# Could also sync vim:
# ansible-playbook -i hosts main.yml --tags default,vim
# vim +'call Initialize()' +'qa'
# Could also secure system
# ansible-playbook -i hosts --ask-become-pass main.yml --tags secure
# Disable password authentication
# ansible-playbook -i 'localhost,' --tags secure --extra-vars 'disable_passwordauth=true' main.yml --ask-become-pass
# Use 1.1.1.1 dns
# ansible-playbook -i 'localhost,' --tags dns main.yml --ask-become-pass
TAGS="$1"
shift
ansible-playbook -i 'localhost,' $* main.yml --tags "$TAGS"