webadmin-user.yml: fir some error backing up .bashrc file.

This commit is contained in:
Christoph 2019-07-18 03:17:12 +02:00
parent 82e4cf0bd6
commit 1c2ca89268

View File

@ -139,24 +139,46 @@
# Copy .bashrc # Copy .bashrc
# --- # ---
#- name: (webadmin-user.yml) Check if webadmin's file '.bashrc.ORIG' exists
# stat:
# path: "~{{ item.item.name }}/.bashrc.ORIG"
# register: bashrc_webadmin_orig_exists
# with_items: "{{ local_template_dir_webadmin.results }}"
# loop_control:
# label: '{{ item.item.name }}'
# when:
# - item.stat.exists
# tags:
# - webadmin
# - bash
#
#- name: (webadmin-user.yml) Backup existing webadmin's .bashrc file
# command: cp ~{{ item.item.item.name }}/.bashrc ~{{ item.item.item.name }}/.bashrc.ORIG
# loop: "{{ bashrc_webadmin_orig_exists.results }}"
# loop_control:
# label: '{{ item.item.item.name }}'
# when:
# - item.stat.exists == False
# tags:
# - webadmin
# - bash
- name: (webadmin-user.yml) Check if webadmin's file '.bashrc.ORIG' exists - name: (webadmin-user.yml) Check if webadmin's file '.bashrc.ORIG' exists
stat: stat:
path: "~{{ item.item.name }}/.bashrc.ORIG" path: "~{{ item.name }}/.bashrc.ORIG"
register: bashrc_webadmin_orig_exists register: bashrc_webadmin_orig_exists
with_items: "{{ local_template_dir_webadmin.results }}" with_items: "{{ webadmin_user }}"
loop_control: loop_control:
label: '{{ item.item.name }}' label: '{{ item.name }}'
when:
- item.stat.exists
tags: tags:
- webadmin - webadmin
- bash - bash
- name: (webadmin-user.yml) Backup existing webadmin's .bashrc file - name: (webadmin-user.yml) Backup existing webadmin's .bashrc file
command: cp ~{{ item.item.name }}/.bashrc ~{{ item.item.name }}/.bashrc.ORIG command: cp -a ~{{ item.item.name }}/.bashrc ~{{ item.item.name }}/.bashrc.ORIG
loop: "{{ bashrc_webadmin_orig_exists.results }}" loop: "{{ bashrc_webadmin_orig_exists.results }}"
loop_control: loop_control:
label: '{{ item.stat.pw_name }}' label: '{{ item.item.name }}'
when: when:
- item.stat.exists == False - item.stat.exists == False
tags: tags:
@ -196,7 +218,7 @@
- profile - profile
- name: (webadmin-user.yml) Backup existing users .profile file - name: (webadmin-user.yml) Backup existing users .profile file
command: cp ~{{ item.item.name }}/.profile ~{{ item.item.name }}/.profile.ORIG command: cp -a ~{{ item.item.name }}/.profile ~{{ item.item.name }}/.profile.ORIG
with_items: "{{ profile_webadmin_orig_exists.results }}" with_items: "{{ profile_webadmin_orig_exists.results }}"
loop_control: loop_control:
label: '{{ item.item.name }}' label: '{{ item.item.name }}'