From 1c2ca89268ade38680db5e607277ff0f583e432e Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 18 Jul 2019 03:17:12 +0200 Subject: [PATCH] webadmin-user.yml: fir some error backing up .bashrc file. --- roles/common/tasks/webadmin-user.yml | 38 ++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/roles/common/tasks/webadmin-user.yml b/roles/common/tasks/webadmin-user.yml index 7688499..bfc7817 100644 --- a/roles/common/tasks/webadmin-user.yml +++ b/roles/common/tasks/webadmin-user.yml @@ -139,24 +139,46 @@ # 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 stat: - path: "~{{ item.item.name }}/.bashrc.ORIG" + path: "~{{ item.name }}/.bashrc.ORIG" register: bashrc_webadmin_orig_exists - with_items: "{{ local_template_dir_webadmin.results }}" + with_items: "{{ webadmin_user }}" loop_control: - label: '{{ item.item.name }}' - when: - - item.stat.exists + label: '{{ item.name }}' tags: - webadmin - bash - 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_control: - label: '{{ item.stat.pw_name }}' + label: '{{ item.item.name }}' when: - item.stat.exists == False tags: @@ -196,7 +218,7 @@ - profile - 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 }}" loop_control: label: '{{ item.item.name }}'