Fix errors checking if local template directory exists.
This commit is contained in:
		| @@ -121,6 +121,15 @@ | ||||
|     - insert_webadmin_ssh_public_key | ||||
|  | ||||
|  | ||||
| # --- | ||||
| # Check if local temlate directories exists | ||||
| # --- | ||||
|  | ||||
| - name: (users-systemfiles.yml) Check if local template directory exists for webadmin | ||||
|   local_action: stat path={{ inventory_dir }}/files/homedirs/webadmin | ||||
|   register: local_template_dir_webadmin | ||||
|  | ||||
|  | ||||
| # -- | ||||
| # Copy .bashrc | ||||
| # --- | ||||
| @@ -132,6 +141,8 @@ | ||||
|   with_items: "{{ webadmin_user }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.name }}' | ||||
|   when: | ||||
|      - local_template_dir_webadmin.stat.exists | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - bash | ||||
| @@ -141,7 +152,9 @@ | ||||
|   with_items: "{{ bashrc_webadmin_orig_exists.results }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.item.name }}' | ||||
|   when: item.stat.exists == False | ||||
|   when: | ||||
|     - local_template_dir_webadmin.stat.exists | ||||
|     - item.stat.exists == False | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - bash | ||||
| @@ -156,7 +169,9 @@ | ||||
|   with_items: "{{ webadmin_user }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.name }}' | ||||
|   when: lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_bashrc') | ||||
|   when: | ||||
|     - local_template_dir_webadmin.stat.exists  | ||||
|     - lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_bashrc') | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - bash | ||||
| @@ -172,6 +187,8 @@ | ||||
|   with_items: "{{ webadmin_user }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.name }}' | ||||
|   when: | ||||
|      - local_template_dir_webadmin.stat.exists | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - profile | ||||
| @@ -181,7 +198,9 @@ | ||||
|   with_items: "{{ profile_webadmin_orig_exists.results }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.item.name }}' | ||||
|   when: item.stat.exists == False  | ||||
|   when: | ||||
|     - local_template_dir_webadmin.stat.exists | ||||
|     - item.stat.exists == False  | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - profile | ||||
| @@ -196,7 +215,9 @@ | ||||
|   with_items: "{{ webadmin_user }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.name }}' | ||||
|   when: lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_profile') | ||||
|   when: | ||||
|     - local_template_dir_webadmin.stat.exists  | ||||
|     - lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_profile') | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - profile | ||||
| @@ -215,7 +236,9 @@ | ||||
|   with_items: "{{ webadmin_user }}" | ||||
|   loop_control: | ||||
|     label: '{{ item.name }}' | ||||
|   when: lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_vimrc') | ||||
|   when: | ||||
|     - local_template_dir_webadmin.stat.exists | ||||
|     - lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_vimrc') | ||||
|   tags: | ||||
|     - webadmin | ||||
|     - vim | ||||
|   | ||||
		Reference in New Issue
	
	Block a user