Merge branch 'feature/ansible' of austenwares.com:stonewareslord/sync into feature/ansible
This commit is contained in:
commit
925065127f
30
README.md
30
README.md
@ -1,12 +1,32 @@
|
|||||||
Sync
|
# Sync
|
||||||
=========
|
|
||||||
|
### Examples
|
||||||
|
#### Delete everything in skel
|
||||||
|
|
||||||
|
./sync.sh clean
|
||||||
|
|
||||||
|
#### 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
|
||||||
|
|
||||||
Sync syncs tmux/vim/bash config files with one command
|
Sync syncs tmux/vim/bash config files with one command
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
usage: sync.sh [-h] [-t] [-c] [-b] [-s] [-d]
|
usage: sync.sh [-h] [-t] [-c] [-b] [-s] [-d]
|
||||||
|
|
||||||
optional arguements:
|
optional arguements:
|
||||||
-h Show this help message and exit
|
-h Show this help message and exit
|
||||||
-t Syncs tmux configuration file
|
-t Syncs tmux configuration file
|
||||||
@ -19,7 +39,7 @@ Or, install vim bundles and vimrc, customizing which bundles you use first (requ
|
|||||||
|
|
||||||
mkdir -p ~/.vim/plugin/ ~/.vim/backup/ ~/.vim/undo/ ~/.vim/tmp/ ~/.vim/bundle/ ~/.vim/bundle/ ; if [ ! -f ~/.vim/plugin/sessionman.vim ] ; then curl -o ~/.vim/plugin/sessionman.vim http://www.vim.org/scripts/download_script.php?src_id=15599 ; fi ; if [ ! -d ~/.vim/bundle/vundle/ ] ; then git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle ; fi ; curl -o ~/.vimrc -k https://austenwares.com/gitlab/stonewareslord/Sync/raw/master/vimrc ; vim ~/.vimrc +"execute \"normal /Bundle 'gmarik\/vundle'\<CR>\"" +"execute \"normal :nohlsearch\<CR>:function Save()\<CR>w\<CR>BundleInstall\<CR>qa\<CR>endfunction\<CR>\"" +"nnoremap <F2> :call Save()<CR>:so ~/.vimrc<CR>:BundleInstall<CR>" ; echo "Installation should be complete. Run \"vim\" to check"
|
mkdir -p ~/.vim/plugin/ ~/.vim/backup/ ~/.vim/undo/ ~/.vim/tmp/ ~/.vim/bundle/ ~/.vim/bundle/ ; if [ ! -f ~/.vim/plugin/sessionman.vim ] ; then curl -o ~/.vim/plugin/sessionman.vim http://www.vim.org/scripts/download_script.php?src_id=15599 ; fi ; if [ ! -d ~/.vim/bundle/vundle/ ] ; then git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle ; fi ; curl -o ~/.vimrc -k https://austenwares.com/gitlab/stonewareslord/Sync/raw/master/vimrc ; vim ~/.vimrc +"execute \"normal /Bundle 'gmarik\/vundle'\<CR>\"" +"execute \"normal :nohlsearch\<CR>:function Save()\<CR>w\<CR>BundleInstall\<CR>qa\<CR>endfunction\<CR>\"" +"nnoremap <F2> :call Save()<CR>:so ~/.vimrc<CR>:BundleInstall<CR>" ; echo "Installation should be complete. Run \"vim\" to check"
|
||||||
|
|
||||||
Usage: run this command and it will automatically load the bundle list with descriptions of each. Delete the ones you don't want to install and press `F2` in normal mode to install al at once.
|
Usage: run this command and it will automatically load the bundle list with descriptions of each. Delete the ones you don't want to install and press `F2` in normal mode to install al at once.
|
||||||
|
|
||||||
Or, temporarily load the bashrc (requires `curl` package):
|
Or, temporarily load the bashrc (requires `curl` package):
|
||||||
|
|
||||||
|
3
main.yml
3
main.yml
@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
vars:
|
vars:
|
||||||
local_path: "{{ '~' | expanduser }}"
|
local_path: "{{ ansible_env.HOME }}"
|
||||||
disable_passwordauth: false
|
disable_passwordauth: false
|
||||||
enable_passwordauth: false
|
enable_passwordauth: false
|
||||||
private_repo: "git@austenwares.com:stonewareslord/private"
|
private_repo: "git@austenwares.com:stonewareslord/private"
|
||||||
roles:
|
roles:
|
||||||
|
- {role: clean, tags: [clean]}
|
||||||
- {role: core, tags: [default]}
|
- {role: core, tags: [default]}
|
||||||
- {role: vim, tags: [vim]}
|
- {role: vim, tags: [vim]}
|
||||||
- {role: youcompleteme, tags: [youcompleteme]}
|
- {role: youcompleteme, tags: [youcompleteme]}
|
||||||
|
12
roles/clean/tasks/main.yml
Normal file
12
roles/clean/tasks/main.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
- name: Remove files
|
||||||
|
file:
|
||||||
|
path: "{{ local_path }}/{{ item.path }}"
|
||||||
|
state: absent
|
||||||
|
with_filetree: "skel/"
|
||||||
|
- name: Remove cloned repositories
|
||||||
|
file:
|
||||||
|
path: "{{ local_path }}/{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- ".fzf"
|
||||||
|
- ".vim"
|
15
sync.sh
15
sync.sh
@ -2,7 +2,7 @@
|
|||||||
\cd "$(dirname $0)"
|
\cd "$(dirname $0)"
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo "$0 TAG1,TAG2"
|
echo "$0 TAG1[,TAG2] [ANSIBLE-OPTS]"
|
||||||
echo "Available tags:"
|
echo "Available tags:"
|
||||||
echo "$(\ls roles | tr '\n' ' ')"
|
echo "$(\ls roles | tr '\n' ' ')"
|
||||||
echo "Example: $0 default,vim"
|
echo "Example: $0 default,vim"
|
||||||
@ -12,13 +12,6 @@ if [ -f .env/bin/activate ]; then
|
|||||||
echo "Found virtualenv. Sourcing..."
|
echo "Found virtualenv. Sourcing..."
|
||||||
source .env/bin/activate
|
source .env/bin/activate
|
||||||
fi
|
fi
|
||||||
ansible-playbook -i 'localhost,' main.yml --tags "$1"
|
TAGS="$1"
|
||||||
# Could also sync vim:
|
shift
|
||||||
# ansible-playbook -i hosts main.yml --tags default,vim
|
ansible-playbook -i 'localhost,' $* main.yml --tags "$TAGS"
|
||||||
# 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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user