111 lines
3.0 KiB
YAML
111 lines
3.0 KiB
YAML
---
|
|
# file: tasks/user.yml
|
|
|
|
- name: user - add hosts_ssh_authorized_keys to ~/.ssh/authorized_keys
|
|
with_items: "{{ hosts_ssh_authorized_keys|default([]) }}"
|
|
authorized_key: user="{{ ansible_user|default('root') }}" key="{{ item }}"
|
|
ignore_errors: true
|
|
|
|
- name: user - copy hosts_ssh_private_keys to ~/.ssh/
|
|
with_items: "{{ hosts_ssh_private_keys|default([]) }}"
|
|
copy: src="{{ item }}" dest=~/.ssh/ mode=0400
|
|
ignore_errors: true
|
|
|
|
- name: user - create ~/.env
|
|
template:
|
|
src: env.j2
|
|
dest: ~/.env
|
|
force: no
|
|
mode: 0400
|
|
|
|
- name: user - create ~/.rc.d
|
|
file: path=~/.rc.d/ state={{hosts_user_rc_enable|default(false)|ternary('directory', 'absent')}} mode="0700"
|
|
|
|
- name: user - source /etc/profile.d/rc_functions.sh
|
|
when: hosts_user_rc_enable|default(false)
|
|
with_items:
|
|
- /etc/profile.d/rc_functions.sh
|
|
lineinfile: dest=~/.rc.d/00_source create=yes line="{{ item }}" mode="0600"
|
|
|
|
- name: user - enable/disable rc functions
|
|
when: hosts_user_rc_enable|default(false)
|
|
with_items: "{{ hosts_user_rc_functions|default([]) }}"
|
|
file: path="~/.rc.d/{{item.path}}" state="{{item.state}}"
|
|
|
|
- name: user - copy ~/.*aliases ~/.*functions ~/.*profile ~/.shrc
|
|
with_items:
|
|
- ".dircolors_aliases"
|
|
- ".docker_aliases"
|
|
- ".resty_aliases"
|
|
- ".vim_aliases"
|
|
- ".sh_functions"
|
|
- ".bash_profile"
|
|
- ".profile"
|
|
- ".shrc"
|
|
copy: src=../files/{{item}} dest=~/{{item}} mode="0640" backup="yes"
|
|
|
|
- name: user - update ~/.bashrc
|
|
with_items:
|
|
- PS1="╭∩╮$PS1"
|
|
- source .shrc
|
|
- unset user_count process_count
|
|
lineinfile: dest=~/.bashrc create=yes line='{{item}}'
|
|
|
|
- name: user - update ~/.config/git/ignore
|
|
with_items:
|
|
- '.nfs*'
|
|
- '*~'
|
|
- '*.log'
|
|
- '*.pyc'
|
|
- '*.swp'
|
|
lineinfile: dest=~/.config/git/ignore create=yes line='{{item}}'
|
|
|
|
- name: user - update ~/.screenrc
|
|
with_items:
|
|
- defscrollback 4096
|
|
- hardstatus alwayslastline "%{= kw}[%{G}$USER@%H%{-}] \# %?%-Lw%?[%{G}%n%f %t%{-}]%?%+Lw%?%?%=%-17< [%{B}%l%{-}]"
|
|
- shell -$SHELL
|
|
lineinfile: dest=~/.screenrc create=yes line='{{item}}'
|
|
|
|
- name: user - update ~/.ssh/config
|
|
with_items:
|
|
- include myos/config
|
|
lineinfile: dest=~/.ssh/config create=yes line='{{item}}'
|
|
|
|
- name: ssh - update ~/.ssh/myos/config
|
|
template:
|
|
src: ssh_config.j2
|
|
dest: ~/.ssh/myos/config
|
|
mode: 0400
|
|
|
|
- name: user - update ~/.tmux.conf
|
|
with_items:
|
|
- source-file ~/.tmux/myos/config
|
|
lineinfile: dest=~/.tmux.conf create=yes line='{{item}}'
|
|
|
|
- name: user - update ~/.tmux/myos/config
|
|
template:
|
|
src: tmux_config.j2
|
|
dest: ~/.tmux/myos/config
|
|
mode: 0400
|
|
|
|
- name: user - update ~/.tmux/myos/session
|
|
template:
|
|
src: tmux_session.j2
|
|
dest: ~/.tmux/myos/session
|
|
mode: 0400
|
|
|
|
- name: user - update ~/.vimrc
|
|
with_items:
|
|
- :set et ai bg=dark sw=2 ts=2 encoding=utf-8 mouse=""
|
|
- :syn on
|
|
- :filetype plugin indent on
|
|
lineinfile: dest=~/.vimrc create=yes line='{{item}}'
|
|
|
|
- name: user - update ~/Makefile
|
|
template:
|
|
src: Makefile.j2
|
|
dest: ~/Makefile
|
|
force: yes
|
|
|