Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
234 lines (208 sloc) 6.57 KB
---
- hosts: localhost
gather_facts: false
vars:
proxy:
http_proxy: "{{ lookup('env', 'http_proxy') | default('') }}"
environment: "{{ proxy }}"
tasks:
- name: Set Proxy to Bash Profile
blockinfile:
path: ~/.bash_profile.local
create: true
block: |
export http_proxy={{ proxy.http_proxy }}
export https_proxy={{ proxy.http_proxy }}
when: proxy.http_proxy != ''
tags: initialize
- name: Set Proxy to Git Config
blockinfile:
path: ~/.gitconfig.local
create: true
block: |
[user]
name =
email =
[http]
proxy = {{ proxy.http_proxy }}
[https]
proxy = {{ proxy.http_proxy }}
when: proxy.http_proxy != ''
tags: initialize
- name: Download IUS Repository Installer
get_url:
url: https://raw.githubusercontent.com/iuscommunity/automation-examples/bash/enable-ius.sh
dest: /tmp/ius.sh
tags: initialize
- name: Install IUS Repository
shell: bash /tmp/ius.sh
args:
creates: /etc/yum.repos.d/ius.repo
become: true
tags: initialize
- name: Download Git-LFS Repository Installer
get_url:
url: https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh
dest: /tmp/git-lfs.sh
tags: initialize
- name: Install Git-LFS Repository
shell: bash /tmp/git-lfs.sh
args:
creates: /etc/yum.repos.d/github_git-lfs.repo
become: true
tags: initialize
- name: Download Nodejs Repository Installer
get_url:
url: https://rpm.nodesource.com/setup_10.x
dest: /tmp/nodejs.sh
tags: initialize
- name: Install Nodejs Repository
shell: bash /tmp/nodejs.sh
args:
creates: /etc/yum.repos.d/nodesource-el.repo
become: true
tags: initialize
- name: Install Ripgrep Repository
shell: yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
args:
creates: /etc/yum.repos.d/carlwgeorge-ripgrep-epel-7.repo
become: true
tags: initialize
- name: Install Packages
yum:
name: "{{ packages }}"
state: latest
vars:
packages:
- make
- which
- git2u
- git-lfs
- python36u
- python36u-devel
- python36u-pip
- neovim
- nodejs
- ripgrep
become: true
tags: [initialize, update]
- name: Install Pipenv Packages
pip:
name: "{{ pip_packages }}"
executable: pip3.6
state: latest
vars:
pip_packages:
- pipenv
- pipenv-pipes
become: true
tags: [initialize, update]
- name: Clone Dotfiles Repository
git:
repo: https://github.com/IMOKURI/dotfiles.git
dest: ~/.dotfiles
track_submodules: true
tags: [initialize, update]
- name: Remove Virtual Env
shell: "pipenv --rm"
args:
chdir: "{{ item }}"
with_items:
- ~/.dotfiles/config/nvim/py2
- ~/.dotfiles/config/nvim/py3
ignore_errors: true
tags: update
- name: Remove Pipfile.lock
file:
path: "{{ item }}"
state: absent
with_items:
- ~/.dotfiles/config/nvim/py2/Pipfile.lock
- ~/.dotfiles/config/nvim/py3/Pipfile.lock
tags: update
- name: Install Python2 Packages
shell: "pipenv install"
args:
chdir: ~/.dotfiles/config/nvim/py2
tags: initialize
- name: Install Python3 Packages
shell: "pipenv install"
args:
chdir: ~/.dotfiles/config/nvim/py3
tags: initialize
- name: Update Python2 Packages
shell: "pipenv update"
args:
chdir: ~/.dotfiles/config/nvim/py2
tags: update
- name: Update Python3 Packages
shell: "pipenv update"
args:
chdir: ~/.dotfiles/config/nvim/py3
tags: update
- name: Install Node.js Packages
npm:
name: "{{ item }}"
path: "{{ lookup('env','HOME') }}"
state: latest
with_items:
- coffeelint
- doctoc
- jsonlint
- neovim
- remark-cli
tags: [initialize, update]
- name: Set Alternative Commands
alternatives:
name: "{{ item.name }}"
link: "{{ item.link }}"
path: "{{ item.path }}"
priority: "{{ item.priority }}"
with_items:
- {name: 'vi', link: '/usr/local/bin/vi', path: "{{ lookup('pipe', 'which nvim') }}", priority: 100}
become: true
tags: initialize
- name: Find Dotfiles Path
find:
paths: ~/.dotfiles
patterns: "^(?!(\\.|README.md|LICENSE|install|setup.yaml)).*$"
use_regex: true
register: find
tags: deploy
- name: Create Symbolic Links To Dotfiles
file:
src: "~/.dotfiles/{{ item.path | regex_replace('^.*/([^/]+)$', '\\1') }}"
dest: "~/.{{ item.path | regex_replace('^.*/([^/]+)$', '\\1') }}"
state: link
force: true
with_items:
- "{{ find.files }}"
tags: deploy
- name: Find Config Dotfiles Path
find:
paths: ~/.dotfiles/config
file_type: any
register: find_config
tags: deploy
- name: Create Config Directory
file:
path: ~/.config
state: directory
tags: deploy
- name: Create Symbolic Links To Config Dotfiles
file:
src: "~/.dotfiles/config/{{ item.path | regex_replace('^.*/([^/]+)$', '\\1') }}"
dest: "~/.config/{{ item.path | regex_replace('^.*/([^/]+)$', '\\1') }}"
state: link
force: true
with_items:
- "{{ find_config.files }}"
tags: deploy
- name: Create Git Work Directory
file:
path: "{{ item }}"
state: directory
with_items:
- ~/github
- ~/ghe
tags: deploy