Add ansible, create directory structure
This commit is contained in:
parent
72412817c7
commit
cc9072dbc5
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.stfolder
|
||||
main.retry
|
||||
|
11
main.yml
Normal file
11
main.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- hosts: local
|
||||
become: false
|
||||
vars:
|
||||
local_path: '/tmp/eee'
|
||||
roles:
|
||||
- {role: core, tags: [default]}
|
||||
- {role: vim, tags: [vim]}
|
||||
- {role: youcompleteme, tags: [vim,youcompleteme]}
|
||||
- {role: secure, sudo: yes, tags: [secure]}
|
||||
- {role: test, tags: [test]}
|
25
roles/core/tasks/main.yml
Normal file
25
roles/core/tasks/main.yml
Normal file
@ -0,0 +1,25 @@
|
||||
- name: Create directories
|
||||
file:
|
||||
path: "{{ local_path }}/{{ item.path }}"
|
||||
state: directory
|
||||
with_filetree: "/skel/"
|
||||
when: item.state == 'directory'
|
||||
- name: Link files
|
||||
file:
|
||||
#src: "/skel/{{ item }}"
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ local_path }}/{{ item.path }}"
|
||||
state: link
|
||||
become: no
|
||||
with_filetree: "/skel/"
|
||||
when: item.state == 'file'
|
||||
- name: Clone fzf
|
||||
git:
|
||||
repo: "https://gitea.austenwares.com/stonewareslord/fzf.git"
|
||||
dest: "{{ local_path }}/.fzf"
|
||||
clone: yes
|
||||
update: yes
|
||||
force: yes
|
||||
become: no
|
||||
- name: Install fzf
|
||||
shell: "{{ local_path|quote }}/.fzf/install --bin"
|
32
roles/secure/tasks/main.yml
Normal file
32
roles/secure/tasks/main.yml
Normal file
@ -0,0 +1,32 @@
|
||||
- name: Protocol 2
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^\s*Protocol\s+2'
|
||||
# insertbefore: '^\s*Match'
|
||||
insertbefore: BOF
|
||||
state: 'present'
|
||||
line: 'Protocol 2'
|
||||
- name: UseDNS no
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^\s*UseDNS\s+no'
|
||||
# insertbefore: '^\s*Match'
|
||||
insertbefore: BOF
|
||||
state: 'present'
|
||||
line: 'UseDNS no'
|
||||
- name: PermitEmptyPasswords no
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^\s*PermitEmptyPasswords\s+no'
|
||||
# insertbefore: '^\s*Match'
|
||||
insertbefore: BOF
|
||||
state: 'present'
|
||||
line: 'PermitEmptyPasswords no'
|
||||
- name: PermitRootLogin without-password
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^\s*PermitRootLogin\s+without-password'
|
||||
# insertbefore: '^\s*Match'
|
||||
insertbefore: BOF
|
||||
state: 'present'
|
||||
line: 'PermitRootLogin without-password'
|
7
roles/test/tasks/main.yml
Normal file
7
roles/test/tasks/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- name: Insert test line
|
||||
lineinfile:
|
||||
path: /tmp/file
|
||||
regexp: '^Listen '
|
||||
insertafter: '^#Listen '
|
||||
state: 'present'
|
||||
line: 'Listen 8080'
|
31
roles/vim/tasks/main.yml
Normal file
31
roles/vim/tasks/main.yml
Normal file
@ -0,0 +1,31 @@
|
||||
- name: Link vimrc
|
||||
file:
|
||||
#src: "/skel/{{ item }}"
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ local_path }}/{{ item.path }}"
|
||||
state: link
|
||||
become: no
|
||||
with_filetree: "/skel/"
|
||||
when: item.state == 'file'
|
||||
- name: Create vim directories
|
||||
file:
|
||||
path: "{{ local_path }}/{{ item.path }}"
|
||||
state: directory
|
||||
with_filetree: "/skel.vim/"
|
||||
when: item.state == 'directory'
|
||||
- name: Install plug
|
||||
get_url:
|
||||
url: "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
|
||||
dest: "{{ local_path }}/.vim/autoload/plug.vim"
|
||||
- name: Clean plugins
|
||||
shell: "vim -E -s -c 'source {{ local_path }}/.vimrc' -c PlugClean! -c qa"
|
||||
# shell: "vim +'silent! PlugClean!' +q!"
|
||||
ignore_errors: yes
|
||||
- name: Install plugins
|
||||
shell: "vim -E -s -c 'source {{ local_path }}/.vimrc' -c PlugInstall! -c qa"
|
||||
# shell: "vim +'silent! PlugInstall!' +q!"
|
||||
ignore_errors: yes
|
||||
- name: Update plugins
|
||||
shell: "vim -E -s -c 'source {{ local_path }}/.vimrc' -c PlugUpdate! -c qa"
|
||||
# shell: "vim +'silent! PlugUpdate!' +q!"
|
||||
ignore_errors: yes
|
29
roles/youcompleteme/tasks/main.yml
Normal file
29
roles/youcompleteme/tasks/main.yml
Normal file
@ -0,0 +1,29 @@
|
||||
- name: Check if cargo is installed
|
||||
shell: command -v cargo >/dev/null 2>&1
|
||||
register: cargo_exists
|
||||
ignore_errors: yes
|
||||
- name: Check if go is installed
|
||||
shell: command -v go >/dev/null 2>&1
|
||||
register: go_exists
|
||||
ignore_errors: yes
|
||||
# TODO: Figure out how to transform cargo_flag.rc == 0 && echo --racer-completer
|
||||
- name: Install youcompleteme
|
||||
shell:
|
||||
cmd: ./install.py
|
||||
chdir: "~/.vim/plugged/YouCompleteMe"
|
||||
when: "go_exists.rc != 0 and cargo_exists.rc != 0"
|
||||
- name: Install youcompleteme with rust
|
||||
shell:
|
||||
cmd: ./install.py --racer-completer
|
||||
chdir: "~/.vim/plugged/YouCompleteMe"
|
||||
when: "go_exists.rc != 0 and cargo_exists.rc == 0"
|
||||
- name: Install youcompleteme with go
|
||||
shell:
|
||||
cmd: ./install.py --gocode-completer
|
||||
chdir: "~/.vim/plugged/YouCompleteMe"
|
||||
when: "go_exists.rc == 0 and cargo_exists.rc != 0"
|
||||
- name: Install youcompleteme with rust and go
|
||||
shell:
|
||||
cmd: ./install.py --gocode-completer --racer-completer
|
||||
chdir: "~/.vim/plugged/YouCompleteMe"
|
||||
when: "go_exists.rc == 0 and cargo_exists.rc == 0"
|
Loading…
Reference in New Issue
Block a user