Support '.vim' directory.
This commit is contained in:
@ -49,7 +49,8 @@
|
||||
- '{{ webadmin_user }}'
|
||||
- ssh_keys
|
||||
loop_control:
|
||||
label: "{{ item.0.name }}"
|
||||
label: "{{ item.0.name }} key: {{ idx + 1 }}"
|
||||
index_var: idx
|
||||
when:
|
||||
- groups['webadmin']|string is search(inventory_hostname)
|
||||
- webadmin_user is defined
|
||||
@ -122,56 +123,59 @@
|
||||
|
||||
|
||||
# ---
|
||||
# Check if local temlate directories exists
|
||||
# Check if local template directories exists
|
||||
# ---
|
||||
|
||||
- name: (users-systemfiles.yml) Check if local template directory exists for webadmin
|
||||
local_action: stat path={{ inventory_dir }}/files/homedirs/webadmin
|
||||
local_action: stat path={{ inventory_dir }}/files/homedirs/{{ item.name }}
|
||||
with_items: "{{ webadmin_user }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
register: local_template_dir_webadmin
|
||||
|
||||
|
||||
|
||||
# --
|
||||
# Copy .bashrc
|
||||
# ---
|
||||
|
||||
- name: (webadmin-user.yml) Check if webadmin's file '.bashrc.ORIG' exists
|
||||
stat:
|
||||
path: "~{{ item.name }}/.bashrc.ORIG"
|
||||
path: "~{{ item.item.name }}/.bashrc.ORIG"
|
||||
register: bashrc_webadmin_orig_exists
|
||||
with_items: "{{ webadmin_user }}"
|
||||
with_items: "{{ local_template_dir_webadmin.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
- item.stat.exists
|
||||
tags:
|
||||
- webadmin
|
||||
- bash
|
||||
|
||||
- name: (webadmin-user.yml) Backup existing webadmin's .bashrc file
|
||||
command: cp ~{{ item.item.name }}/.bashrc ~{{ item.item.name }}/.bashrc.ORIG
|
||||
with_items: "{{ bashrc_webadmin_orig_exists.results }}"
|
||||
loop: "{{ bashrc_webadmin_orig_exists.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
label: '{{ item.stat.pw_name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
- item.stat.exists == False
|
||||
tags:
|
||||
- webadmin
|
||||
- bash
|
||||
|
||||
- name: (webadmin-user.yml) copy new .bashrc ifor webadmin if it exists
|
||||
- name: (webadmin-user.yml) copy new .bashrc for webadmin if it exists
|
||||
copy:
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_bashrc') }}"
|
||||
dest: "~{{ item.name }}/.bashrc"
|
||||
owner: "{{ item.name }}"
|
||||
group: "{{ item.name }}"
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bashrc') }}"
|
||||
dest: "~{{ item.item.name }}/.bashrc"
|
||||
owner: "{{ item.item.name }}"
|
||||
group: "{{ item.item.name }}"
|
||||
mode: 0644
|
||||
with_items: "{{ webadmin_user }}"
|
||||
with_items: "{{ local_template_dir_webadmin.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_bashrc')
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bashrc')
|
||||
tags:
|
||||
- webadmin
|
||||
- bash
|
||||
@ -187,8 +191,6 @@
|
||||
with_items: "{{ webadmin_user }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
tags:
|
||||
- webadmin
|
||||
- profile
|
||||
@ -199,7 +201,6 @@
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
- item.stat.exists == False
|
||||
tags:
|
||||
- webadmin
|
||||
@ -207,17 +208,17 @@
|
||||
|
||||
- name: (webadmin-user.yml) copy .profile for user webadmin if it exists
|
||||
copy:
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_profile') }}"
|
||||
dest: "~{{ item.name }}/.profile"
|
||||
owner: "{{ item.name }}"
|
||||
group: "{{ item.name }}"
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_profile') }}"
|
||||
dest: "~{{ item.item.name }}/.profile"
|
||||
owner: "{{ item.item.name }}"
|
||||
group: "{{ item.item.name }}"
|
||||
mode: 0644
|
||||
with_items: "{{ webadmin_user }}"
|
||||
with_items: "{{ local_template_dir_webadmin.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_profile')
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_profile')
|
||||
tags:
|
||||
- webadmin
|
||||
- profile
|
||||
@ -228,17 +229,40 @@
|
||||
|
||||
- name: (webadmin-user.yml) copy .vimrc for user webadmin if it exists
|
||||
copy:
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_vimrc') }}"
|
||||
dest: "~{{ item.name }}/.vimrc"
|
||||
owner: "{{ item.name }}"
|
||||
group: "{{ item.name }}"
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_vimrc') }}"
|
||||
dest: "~{{ item.item.name }}/.vimrc"
|
||||
owner: "{{ item.item.name }}"
|
||||
group: "{{ item.item.name }}"
|
||||
mode: 0644
|
||||
with_items: "{{ webadmin_user }}"
|
||||
with_items: "{{ local_template_dir_webadmin.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- local_template_dir_webadmin.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_vimrc')
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_vimrc')
|
||||
tags:
|
||||
- webadmin
|
||||
- vim
|
||||
|
||||
- name: (users-systemfiles.yml) Check if local template directory .vim exists for webadmin
|
||||
local_action: stat path={{ inventory_dir }}/files/homedirs/webadmin/.vim
|
||||
register: local_template_dir_vim_webadmin
|
||||
with_items: "{{ webadmin_user }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
|
||||
- name: (webadmin-user.yml) copy .vim directory for user webadmin if it exists
|
||||
copy:
|
||||
src: "{{ inventory_dir + '/files/homedirs/' + item.item.name + '/.vim' }}"
|
||||
dest: "~{{ item.item.name }}"
|
||||
owner: "{{ item.item.name }}"
|
||||
group: "{{ item.item.name }}"
|
||||
mode: 0644
|
||||
with_items: "{{ local_template_dir_vim_webadmin.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- item.stat.exists
|
||||
tags:
|
||||
- webadmin
|
||||
- vim
|
||||
|
Reference in New Issue
Block a user