init dotfiles repo
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
---
|
||||
- import_tasks: vim.yml
|
||||
|
||||
- name: Copy the global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/
|
||||
|
||||
- name: Ensure Arch Linux sources bash_aliases
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
# regexp: '\.bash_aliases'
|
||||
line: '[ -f ~/.bash_aliases ] && source ~/.bash_aliases'
|
||||
create: yes
|
||||
|
||||
- name: Copy shell configuration
|
||||
ansible.builtin.copy:
|
||||
src: inputrc
|
||||
dest: "{{ item }}/.inputrc"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.PWD }}/"
|
||||
|
||||
- name: Copy bash aliases
|
||||
ansible.builtin.copy:
|
||||
src: bash_aliases
|
||||
dest: "{{ item }}/.bash_aliases"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.PWD }}/"
|
||||
|
||||
- name: Add root bashrc shell history configuration
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^(export )?HISTCONTROL='
|
||||
line: 'HISTCONTROL=ignoreboth'
|
||||
state: present
|
||||
|
||||
- name: Add root bashrc and vim configuration for RedHat
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: '^(export )?VISUAL='
|
||||
line: 'export VISUAL=vim'
|
||||
- regexp: '^(export )?EDITOR='
|
||||
line: 'export EDITOR=vim'
|
||||
- regexp: '^(export )?SUDO_EDITOR='
|
||||
line: 'export SUDO_EDITOR=vim'
|
||||
|
||||
- name: Add functional alias to restart a service and show the log
|
||||
blockinfile:
|
||||
path: /root/.bashrc
|
||||
block: |
|
||||
pheonix() {
|
||||
systemctl restart $1;journalctl -fu $1
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
- import_tasks: vim.yml
|
||||
|
||||
- name: Copy the global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/vim/
|
||||
|
||||
- name: Ensure vim will source a global configuration file
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/vim/vimrc
|
||||
marker: '" {mark} ANSIBLE MANAGED BLOCK'
|
||||
block: |
|
||||
set runtimepath+=/var/lib/vim/addons
|
||||
if filereadable("/etc/vimrc.local")
|
||||
source /etc/vimrc.local
|
||||
endif
|
||||
|
||||
- name: Ensure Debian sources .bash_aliases
|
||||
ansible.builtin.lineinfile:
|
||||
path: /root/.bashrc
|
||||
# regexp: '\.bash_aliases'
|
||||
line: 'source ~/.bash_aliases'
|
||||
|
||||
- name: Copy shell configuration
|
||||
ansible.builtin.copy:
|
||||
src: inputrc
|
||||
dest: "{{ item }}/.inputrc"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.PWD }}/"
|
||||
|
||||
- name: Copy bash aliases
|
||||
ansible.builtin.copy:
|
||||
src: bash_aliases
|
||||
dest: "{{ item }}/.bash_aliases"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.HOME }}/"
|
||||
|
||||
- name: Add root bashrc shell history configuration
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^(export )?HISTCONTROL='
|
||||
line: 'HISTCONTROL=ignoreboth'
|
||||
state: present
|
||||
|
||||
- name: Add root bashrc and vim configuration.
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: '^(export )?VISUAL='
|
||||
line: 'export VISUAL=vim.basic'
|
||||
- regexp: '^(export )?EDITOR='
|
||||
line: 'export EDITOR=vim.basic'
|
||||
- regexp: '^(export )?SUDO_EDITOR='
|
||||
line: 'export SUDO_EDITOR=vim.basic'
|
||||
|
||||
- name: Add functional alias to restart a service and show the log
|
||||
blockinfile:
|
||||
path: /root/.bashrc
|
||||
block: |
|
||||
pheonix() {
|
||||
systemctl restart $1;journalctl -fu $1
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
- import_tasks: vim.yml
|
||||
|
||||
- name: Copy the global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/
|
||||
|
||||
- name: Copy shell configuration
|
||||
ansible.builtin.copy:
|
||||
src: inputrc
|
||||
dest: "{{ dotfile_path }}/.inputrc"
|
||||
loop_control:
|
||||
loop_var: dotfile_path
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.PWD }}/"
|
||||
|
||||
- name: Install global bash aliases
|
||||
ansible.builtin.copy:
|
||||
src: bash_aliases
|
||||
dest: /etc/profile.d/zz_aliases.sh
|
||||
mode: '0755'
|
||||
|
||||
#- name: Add root bashrc shell history configuration
|
||||
# lineinfile:
|
||||
# path: /root/.bashrc
|
||||
# regexp: '^(export )?HISTCONTROL='
|
||||
# line: 'HISTCONTROL=ignoreboth'
|
||||
# state: present
|
||||
#
|
||||
#- name: Add root bashrc and vim configuration for RedHat
|
||||
# lineinfile:
|
||||
# path: /root/.bashrc
|
||||
# regexp: "{{ item.regexp }}"
|
||||
# line: "{{ item.line }}"
|
||||
# state: present
|
||||
# with_items:
|
||||
# - regexp: '^(export )?VISUAL='
|
||||
# line: 'export VISUAL=vim'
|
||||
# - regexp: '^(export )?EDITOR='
|
||||
# line: 'export EDITOR=vim'
|
||||
# - regexp: '^(export )?SUDO_EDITOR='
|
||||
# line: 'export SUDO_EDITOR=vim'
|
||||
#
|
||||
#- name: Add functional alias to restart a service and show the log
|
||||
# blockinfile:
|
||||
# path: /root/.bashrc
|
||||
# block: |
|
||||
# pheonix() {
|
||||
# systemctl restart $1;journalctl -fu $1
|
||||
# }
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
- import_tasks: vim.yml
|
||||
|
||||
- name: Copy the global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/vim/
|
||||
|
||||
- name: Ensure vim will source a global configuration file
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/vim/vimrc
|
||||
marker: '" {mark} ANSIBLE MANAGED BLOCK'
|
||||
block: |
|
||||
set runtimepath+=/var/lib/vim/addons
|
||||
if filereadable("/etc/vimrc.local")
|
||||
source /etc/vimrc.local
|
||||
endif
|
||||
|
||||
- name: Copy shell configuration
|
||||
ansible.builtin.copy:
|
||||
src: inputrc
|
||||
dest: "{{ item }}/.inputrc"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.HOME }}/"
|
||||
|
||||
- name: Copy bash aliases
|
||||
ansible.builtin.copy:
|
||||
src: bash_aliases
|
||||
dest: "{{ item }}/.bash_aliases"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.HOME }}/"
|
||||
|
||||
- name: Add root bashrc shell history configuration
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^(export )?HISTCONTROL='
|
||||
line: 'HISTCONTROL=ignoreboth'
|
||||
state: present
|
||||
|
||||
- name: Add root bashrc and vim configuration.
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: '^(export )?VISUAL='
|
||||
line: 'export VISUAL=vim.basic'
|
||||
- regexp: '^(export )?EDITOR='
|
||||
line: 'export EDITOR=vim.basic'
|
||||
- regexp: '^(export )?SUDO_EDITOR='
|
||||
line: 'export SUDO_EDITOR=vim.basic'
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Add functional alias to restart a service and show the log
|
||||
blockinfile:
|
||||
path: /root/.bashrc
|
||||
block: |
|
||||
pheonix() {
|
||||
systemctl restart $1;journalctl -fu $1
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
- import_tasks: vim.yml
|
||||
|
||||
- name: Copy the global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/
|
||||
|
||||
- name: Copy shell configuration
|
||||
ansible.builtin.copy:
|
||||
src: inputrc
|
||||
dest: "{{ item }}/.inputrc"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.PWD }}/"
|
||||
|
||||
- name: Copy bash aliases
|
||||
ansible.builtin.copy:
|
||||
src: bash_aliases
|
||||
dest: "{{ item }}/.bash_aliases"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
- "{{ ansible_env.HOME }}/"
|
||||
|
||||
- name: Add root bashrc shell history configuration
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^(export )?HISTCONTROL='
|
||||
line: 'HISTCONTROL=ignoreboth'
|
||||
state: present
|
||||
|
||||
- name: Add root bashrc and vim configuration for RedHat
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: '^(export )?VISUAL='
|
||||
line: 'export VISUAL=vim'
|
||||
- regexp: '^(export )?EDITOR='
|
||||
line: 'export EDITOR=vim'
|
||||
- regexp: '^(export )?SUDO_EDITOR='
|
||||
line: 'export SUDO_EDITOR=vim'
|
||||
|
||||
- name: Add functional alias to restart a service and show the log
|
||||
blockinfile:
|
||||
path: /root/.bashrc
|
||||
block: |
|
||||
pheonix() {
|
||||
systemctl restart $1;journalctl -fu $1
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Show (ansible_distribution)-(ansible_facts.distribution_major_version)
|
||||
debug:
|
||||
msg: "{{ ansible_distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
|
||||
|
||||
- name: Run tasks based on the OS type, or a default if not found.
|
||||
include_tasks:
|
||||
file: "{{ task_target }}"
|
||||
apply:
|
||||
become: yes
|
||||
loop_control:
|
||||
loop_var: task_target
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
|
||||
- "{{ ansible_distribution }}.yml"
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
- "default.yml"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: Ensure a path for vim addons exists.
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/vim/addons/colors
|
||||
state: directory
|
||||
|
||||
- name: Copy the vim colorscheme
|
||||
ansible.builtin.copy:
|
||||
src: ir_black.vim
|
||||
dest: /var/lib/vim/addons/colors/
|
||||
Reference in New Issue
Block a user