Fix errors checking if local template directory exists.
This commit is contained in:
parent
185a7bce72
commit
ccebad0f6c
@ -144,7 +144,6 @@ apt_initial_install_stretch:
|
||||
- iputils-ping
|
||||
- apt-utils
|
||||
- aptitude
|
||||
- apt-transport-https
|
||||
- zip
|
||||
- unzip
|
||||
- bzip2
|
||||
@ -257,7 +256,6 @@ apt_initial_install_buster:
|
||||
- iputils-ping
|
||||
- apt-utils
|
||||
- aptitude
|
||||
- apt-transport-https
|
||||
- zip
|
||||
- unzip
|
||||
- bzip2
|
||||
@ -826,6 +824,10 @@ git_mailserver_repositories:
|
||||
repo: https://git.oopen.de/install/php
|
||||
dest: /usr/local/src/php
|
||||
|
||||
- name: mysql
|
||||
repo: https://git.oopen.de/install/mysql
|
||||
dest: /usr/local/src/mysql
|
||||
|
||||
- name: mailsystem
|
||||
repo: https://git.oopen.de/install/mailsystem
|
||||
dest: /usr/local/src/mailsystem
|
||||
|
2
hosts
2
hosts
@ -151,6 +151,7 @@ a.ns.oopen.de
|
||||
|
||||
# - local network ckubu
|
||||
gw-ckubu.local.netz
|
||||
gw-akb.akb.netz
|
||||
|
||||
# - GA - Gemeinschaft Altensclirf
|
||||
ga-st-lxc1.ga.netz
|
||||
@ -938,6 +939,7 @@ a.ns.oopen.de
|
||||
# ---
|
||||
|
||||
gw-ckubu.local.netz
|
||||
gw-akb.akb.netz
|
||||
|
||||
|
||||
[warenform_server]
|
||||
|
@ -1,5 +1,22 @@
|
||||
---
|
||||
|
||||
# ---
|
||||
# Check if local template directories exists
|
||||
# ---
|
||||
|
||||
# default_users
|
||||
- name: (users-systemfiles.yml) Check if local template directory exists for default users
|
||||
local_action: stat path={{ inventory_dir }}/files/homedirs/{{ item.name }}
|
||||
with_items: "{{ default_user }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
register: local_template_dir_default_user
|
||||
|
||||
# root
|
||||
- name: (users-systemfiles.yml) Check if local template directory exists for root
|
||||
local_action: stat path={{ inventory_dir }}/files/homedirs/root
|
||||
register: local_template_dir_root
|
||||
|
||||
# --
|
||||
# Copy .bashrc
|
||||
# ---
|
||||
@ -19,24 +36,23 @@
|
||||
loop: "{{ bashrc_user_orig_exists.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.item.name }}'
|
||||
#with_items: "{{ bashrc_user_orig_exists.results }}"
|
||||
when: item.stat.exists == False
|
||||
tags:
|
||||
- bash
|
||||
|
||||
- name: (users-systemfiles.yml) copy .bashrc 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
|
||||
loop: "{{ default_user }}"
|
||||
loop: "{{ local_template_dir_default_user.results}}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name)
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_bashrc')
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bashrc')
|
||||
tags:
|
||||
- bash
|
||||
|
||||
@ -61,7 +77,7 @@
|
||||
group: root
|
||||
mode: 0644
|
||||
when:
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root')
|
||||
- local_template_dir_root.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_bashrc')
|
||||
tags:
|
||||
- bash
|
||||
@ -91,17 +107,17 @@
|
||||
|
||||
- name: (users-systemfiles.yml) copy .profile 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
|
||||
loop: "{{ default_user }}"
|
||||
loop: "{{ local_template_dir_default_user.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name)
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_profile')
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_profile')
|
||||
tags:
|
||||
- profile
|
||||
|
||||
@ -126,7 +142,7 @@
|
||||
group: root
|
||||
mode: 0644
|
||||
when:
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root')
|
||||
- local_template_dir_root.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_profile')
|
||||
tags:
|
||||
- profile
|
||||
@ -137,17 +153,17 @@
|
||||
|
||||
- name: (users-systemfiles.yml) copy .vimrc 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
|
||||
loop: "{{ default_user }}"
|
||||
loop: "{{ local_template_dir_default_user.results }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.item.name }}'
|
||||
when:
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name)
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_vimrc')
|
||||
- item.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_vimrc')
|
||||
tags:
|
||||
- vim
|
||||
|
||||
@ -159,8 +175,8 @@
|
||||
group: root
|
||||
mode: 0644
|
||||
when:
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root')
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.name + '/_vimrc')
|
||||
- local_template_dir_root.stat.exists
|
||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_vimrc')
|
||||
tags:
|
||||
- vim
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user