update..
This commit is contained in:
@ -83,7 +83,7 @@
|
||||
- bash
|
||||
|
||||
# --
|
||||
# Copy .profile
|
||||
# Copy .profile (Debian System)
|
||||
# ---
|
||||
|
||||
- name: (users-systemfiles.yml) Check if users file '.profile.ORIG' exists
|
||||
@ -93,6 +93,8 @@
|
||||
loop: "{{ default_user }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags:
|
||||
- profile
|
||||
|
||||
@ -101,7 +103,9 @@
|
||||
loop: "{{ profile_user_orig_exists.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
when: item.stat.exists == False
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
- item.stat.exists == False
|
||||
tags:
|
||||
- profile
|
||||
|
||||
@ -116,6 +120,7 @@
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_profile')
|
||||
tags:
|
||||
@ -125,12 +130,16 @@
|
||||
stat:
|
||||
path: /root/.profile.ORIG
|
||||
register: profile_root_orig_exists
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags:
|
||||
- profile
|
||||
|
||||
- name: (users-systemfiles.yml) Backup existing users .profile file
|
||||
command: cp -a /root/.profile /root/.profile.ORIG
|
||||
when: profile_root_orig_exists.stat.exists == False
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
- profile_root_orig_exists.stat.exists == False
|
||||
tags:
|
||||
- profile
|
||||
|
||||
@ -142,10 +151,87 @@
|
||||
group: root
|
||||
mode: 0644
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
- local_template_dir_root.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_profile')
|
||||
tags:
|
||||
- profile
|
||||
|
||||
# --
|
||||
# Copy .bash_profile (CentOS/Fedora?/RedHat? System)
|
||||
# ---
|
||||
|
||||
- name: (users-systemfiles.yml) Check if users file '.bash_profile.ORIG' exists
|
||||
stat:
|
||||
path: "~{{ item.name }}/.bash_profile.ORIG"
|
||||
register: bash_profile_user_orig_exists
|
||||
loop: "{{ default_user }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
when:
|
||||
- ansible_facts['distribution'] == "CentOS"
|
||||
tags:
|
||||
- profile
|
||||
|
||||
- name: (users-systemfiles.yml) Backup existing users .bash_profile file
|
||||
command: cp -a ~{{ item.item.name }}/.bash_profile ~{{ item.item.name }}/.bash_profile.ORIG
|
||||
loop: "{{ bash_profile_user_orig_exists.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- ansible_facts['distribution'] == "CentOS"
|
||||
- item.stat.exists == False
|
||||
tags:
|
||||
- profile
|
||||
|
||||
- name: (users-systemfiles.yml) copy .bash_profile if it exists
|
||||
copy:
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bash_profile') }}"
|
||||
dest: "~{{ item.item.name }}/.bash_profile"
|
||||
owner: "{{ item.item.name }}"
|
||||
group: "{{ item.item.name }}"
|
||||
mode: 0644
|
||||
loop: "{{ local_template_dir_default_user.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- ansible_facts['distribution'] == "CentOS"
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bash_profile')
|
||||
tags:
|
||||
- profile
|
||||
|
||||
|
||||
- name: (users-systemfiles.yml) Check if file '/root/.bash_profile.ORIG' exists
|
||||
stat:
|
||||
path: /root/.bash_profile.ORIG
|
||||
register: profile_root_orig_exists
|
||||
when:
|
||||
- ansible_facts['distribution'] == "CentOS"
|
||||
tags:
|
||||
- profile
|
||||
|
||||
- name: (users-systemfiles.yml) Backup existing users .bash_profile file
|
||||
command: cp -a /root/.bash_profile /root/.bash_profile.ORIG
|
||||
when:
|
||||
- ansible_facts['distribution'] == "CentOS"
|
||||
- profile_root_orig_exists.stat.exists == False
|
||||
tags:
|
||||
- profile
|
||||
|
||||
- name: (users-systemfiles.yml) copy .bash_profile for user root
|
||||
copy:
|
||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/root/_bash_profile') }}"
|
||||
dest: "/root/.bash_profile"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when:
|
||||
- ansible_facts['distribution'] == "CentOS"
|
||||
- local_template_dir_root.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_bash_profile')
|
||||
tags:
|
||||
- profile
|
||||
|
||||
# --
|
||||
# Copy .vimrc
|
||||
|
Reference in New Issue
Block a user