update..
This commit is contained in:
11
ansible.cfg
11
ansible.cfg
@@ -10,7 +10,16 @@
|
|||||||
|
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
ansible_managed = *** [ Ansible managed file: DO NOT EDIT DIRECTLY ] ***
|
# [DEPRECATION WARNING] 'ansible_managed' used in ansible.cfg
|
||||||
|
#
|
||||||
|
# The `ansible_managed` variable can be set just like any other variable, or a different
|
||||||
|
# variable can be used.
|
||||||
|
#
|
||||||
|
# Alternatives: Set the `ansible_managed` variable, or use any custom variable in templates.
|
||||||
|
#
|
||||||
|
# This feature will be removed from ansible-core version 2.23.
|
||||||
|
#
|
||||||
|
#ansible_managed = *** [ Ansible managed file: DO NOT EDIT DIRECTLY ] ***
|
||||||
|
|
||||||
# Use of 'ansible_managed'
|
# Use of 'ansible_managed'
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
ansible_managed: >
|
||||||
|
*** ANSIBLE MANAGED FILE - DO NOT EDIT ***
|
||||||
|
This file was generated by {{ ansible_user_id }} on {{ ansible_date_time.iso8601 }}
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# vars used by roles/ansible_dependencies
|
# vars used by roles/ansible_dependencies
|
||||||
# ---
|
# ---
|
||||||
|
|||||||
@@ -423,6 +423,7 @@ samba_user:
|
|||||||
- name: lino.koehler
|
- name: lino.koehler
|
||||||
groups:
|
groups:
|
||||||
- projekte
|
- projekte
|
||||||
|
- team
|
||||||
password: '20.l1no-ko3hl3r_25/'
|
password: '20.l1no-ko3hl3r_25/'
|
||||||
|
|
||||||
- name: maite.gabriel
|
- name: maite.gabriel
|
||||||
|
|||||||
@@ -92,14 +92,13 @@
|
|||||||
# ---
|
# ---
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Check if file '/root/bin/samba/clean_samba_trash.sh' exists
|
- name: (samba-config-server.yml) Check if file '/root/bin/samba/clean_samba_trash.sh' exists
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /root/bin/samba/clean_samba_trash.sh
|
path: /root/bin/samba/clean_samba_trash.sh
|
||||||
register: clean_samba_trash_exists
|
register: clean_samba_trash_exists
|
||||||
when:
|
when:
|
||||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
- inventory_hostname in groups['samba_server']
|
||||||
tags:
|
tags: [samba-server, samba-cron]
|
||||||
- samba-server
|
|
||||||
- samba-cron
|
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Adjust configuration for script 'clean_samba_trash.sh'
|
- name: (samba-config-server.yml) Adjust configuration for script 'clean_samba_trash.sh'
|
||||||
template:
|
template:
|
||||||
@@ -114,36 +113,33 @@
|
|||||||
|
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Check if cleaning up trash dirs is configured
|
- name: (samba-config-server.yml) Check if cleaning up trash dirs is configured
|
||||||
lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /root/bin/samba/conf/clean_samba_trash.conf
|
path: /root/bin/samba/conf/clean_samba_trash.conf
|
||||||
regexp: "^trash_dirs=*"
|
regexp: '^trash_dirs=*'
|
||||||
state: absent
|
state: absent
|
||||||
check_mode: yes
|
check_mode: true
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: clean_samba_trash_dirs
|
register: clean_samba_trash_dirs
|
||||||
when:
|
when:
|
||||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
- inventory_hostname in groups['samba_server']
|
||||||
tags:
|
tags: [samba-server, samba-cron]
|
||||||
- samba-server
|
|
||||||
- samba-cron
|
|
||||||
|
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Creates a cron job for cleaning up samba trash dirs
|
- name: (samba-config-server.yml) Creates a cron job for cleaning up samba trash dirs
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
name: '{{ samba_cronjob_trash_dirs.name }}'
|
name: "{{ samba_cronjob_trash_dirs.name }}"
|
||||||
minute: '{{ samba_cronjob_trash_dirs.minute }}'
|
minute: "{{ samba_cronjob_trash_dirs.minute }}"
|
||||||
hour: "{{ samba_cronjob_trash_dirs.hour | default('*') }}"
|
hour: "{{ samba_cronjob_trash_dirs.hour | default('*') }}"
|
||||||
day: "{{ samba_cronjob_trash_dirs.hour.day | default('*') }}"
|
day: "{{ samba_cronjob_trash_dirs.day | default('*') }}"
|
||||||
month: "{{ samba_cronjob_trash_dirs.hour.month| default('*') }}"
|
month: "{{ samba_cronjob_trash_dirs.month | default('*') }}"
|
||||||
weekday: "{{ samba_cronjob_trash_dirs.hour.weekday| default('*') }}"
|
weekday: "{{ samba_cronjob_trash_dirs.weekday | default('*') }}"
|
||||||
user: "{{ samba_cronjob_trash_dirs.user | default('root') }}"
|
user: "{{ samba_cronjob_trash_dirs.user | default('root') }}"
|
||||||
job: "{{ samba_cronjob_trash_dirs.job }}"
|
job: "{{ samba_cronjob_trash_dirs.job }}"
|
||||||
when:
|
when:
|
||||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
- inventory_hostname in groups['samba_server']
|
||||||
- clean_samba_trash_exists.stat.exists|bool and clean_samba_trash_dirs.found
|
- clean_samba_trash_exists.stat.exists | bool
|
||||||
tags:
|
- (clean_samba_trash_dirs.found | int) > 0
|
||||||
- samba-server
|
tags: [samba-server, samba-cron]
|
||||||
- samba-cron
|
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
@@ -151,41 +147,37 @@
|
|||||||
# ---
|
# ---
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Check if file '/root/bin/samba/set_permissions_samba_shares.sh' exists
|
- name: (samba-config-server.yml) Check if file '/root/bin/samba/set_permissions_samba_shares.sh' exists
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /root/bin/samba/set_permissions_samba_shares.sh
|
path: /root/bin/samba/set_permissions_samba_shares.sh
|
||||||
register: set_permissions_on_samba_shares_exists
|
register: set_permissions_on_samba_shares_exists
|
||||||
when:
|
when:
|
||||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
- inventory_hostname in groups['samba_server']
|
||||||
tags:
|
tags: [samba-server, samba-cron]
|
||||||
- samba-server
|
|
||||||
- samba-cron
|
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Adjust configuration for script 'set_permissions_samba_shares.sh'
|
- name: (samba-config-server.yml) Adjust configuration for script 'set_permissions_samba_shares.sh'
|
||||||
template:
|
ansible.builtin.template:
|
||||||
dest: /root/bin/samba/conf/set_permissions_samba_shares.conf
|
dest: /root/bin/samba/conf/set_permissions_samba_shares.conf
|
||||||
src: root/bin/samba/conf/set_permissions_samba_shares.conf.j2
|
src: root/bin/samba/conf/set_permissions_samba_shares.conf.j2
|
||||||
when:
|
when:
|
||||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
- inventory_hostname in groups['samba_server']
|
||||||
- set_permissions_on_samba_shares_exists.stat.exists|bool
|
- set_permissions_on_samba_shares_exists.stat.exists | bool
|
||||||
tags:
|
tags: [samba-server, samba-cron]
|
||||||
- samba-server
|
|
||||||
- samba-cron
|
|
||||||
|
|
||||||
|
|
||||||
- name: (samba-config-server.yml) Creates a cron job for cleaning up samba trash dirs
|
- name: (samba-config-server.yml) Creates a cron job for cleaning up samba trash dirs
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
name: '{{ samba_cronjob_permissions.name }}'
|
name: "{{ samba_cronjob_permissions.name }}"
|
||||||
minute: '{{ samba_cronjob_permissions.minute }}'
|
minute: "{{ samba_cronjob_permissions.minute }}"
|
||||||
hour: "{{ samba_cronjob_permissions.hour | default('*') }}"
|
hour: "{{ samba_cronjob_permissions.hour | default('*') }}"
|
||||||
day: "{{ samba_cronjob_permissions.day | default('*') }}"
|
day: "{{ samba_cronjob_permissions.day | default('*') }}"
|
||||||
month: "{{ samba_cronjob_permissions.month| default('*') }}"
|
month: "{{ samba_cronjob_permissions.month | default('*') }}"
|
||||||
weekday: "{{ samba_cronjob_permissions.weekday| default('*') }}"
|
weekday: "{{ samba_cronjob_permissions.weekday | default('*') }}"
|
||||||
user: "{{ samba_cronjob_permissions.user | default('root') }}"
|
user: "{{ samba_cronjob_permissions.user | default('root') }}"
|
||||||
job: "{{ samba_cronjob_permissions.job }}"
|
job: "{{ samba_cronjob_permissions.job }}"
|
||||||
when:
|
when:
|
||||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
- inventory_hostname in groups['samba_server']
|
||||||
- clean_samba_trash_dirs.found
|
- (clean_samba_trash_dirs.found | int) > 0 # << int -> bool
|
||||||
tags:
|
tags: [samba-server, samba-cron]
|
||||||
- samba-server
|
|
||||||
- samba-cron
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
local_action: stat path={{ inventory_dir }}/files/homedirs/root
|
local_action: stat path={{ inventory_dir }}/files/homedirs/root
|
||||||
register: local_template_dir_root
|
register: local_template_dir_root
|
||||||
|
|
||||||
|
|
||||||
# --
|
# --
|
||||||
# Copy .bashrc
|
# Copy .bashrc
|
||||||
# ---
|
# ---
|
||||||
@@ -40,22 +41,37 @@
|
|||||||
tags:
|
tags:
|
||||||
- bash
|
- bash
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .bashrc if it exists
|
# 1. Prüfen, ob für jeden User ein lokales _bashrc existiert
|
||||||
copy:
|
- name: (users-systemfiles.yml) stat user _bashrc
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bashrc') }}"
|
ansible.builtin.stat:
|
||||||
dest: "~{{ item.item.name }}/.bashrc"
|
path: "{{ inventory_dir }}/files/homedirs/{{ item.name }}/_bashrc"
|
||||||
owner: "{{ item.item.name }}"
|
delegate_to: localhost
|
||||||
group: "{{ item.item.name }}"
|
become: false
|
||||||
mode: 0644
|
loop: "{{ default_user }}"
|
||||||
loop: "{{ local_template_dir_default_user.results }}"
|
register: bashrc_stats
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.item.name }}'
|
label: '{{ item.name }}'
|
||||||
|
|
||||||
|
# 2. Falls vorhanden, Datei kopieren
|
||||||
|
- name: (users-systemfiles.yml) copy .bashrc if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/{{ user.name }}/_bashrc"
|
||||||
|
dest: "~{{ user.name }}/.bashrc"
|
||||||
|
owner: "{{ user.name }}"
|
||||||
|
group: "{{ user.name }}"
|
||||||
|
mode: '0644'
|
||||||
|
loop: "{{ default_user | zip(bashrc_stats.results) | list }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ user.name }}"
|
||||||
when:
|
when:
|
||||||
- item.stat.exists
|
- stat_result.stat.exists
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bashrc')
|
vars:
|
||||||
|
user: "{{ item.0 }}"
|
||||||
|
stat_result: "{{ item.1 }}"
|
||||||
tags:
|
tags:
|
||||||
- bash
|
- bash
|
||||||
|
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) Check if file '/root/.bashrc.ORIG' exists
|
- name: (users-systemfiles.yml) Check if file '/root/.bashrc.ORIG' exists
|
||||||
stat:
|
stat:
|
||||||
path: /root/.bashrc.ORIG
|
path: /root/.bashrc.ORIG
|
||||||
@@ -69,19 +85,28 @@
|
|||||||
tags:
|
tags:
|
||||||
- bash
|
- bash
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .bashrc for user root
|
# 1) Prüfen ob die _bashrc für root auf dem Control-Node existiert
|
||||||
copy:
|
- name: stat root _bashrc on control node
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/root/_bashrc') }}"
|
ansible.builtin.stat:
|
||||||
dest: "/root/.bashrc"
|
path: "{{ inventory_dir }}/files/homedirs/root/_bashrc"
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
register: bashrc_root_stat
|
||||||
|
|
||||||
|
# 2) Wenn vorhanden, kopieren wir sie nach /root/.bashrc auf dem Zielhost
|
||||||
|
- name: copy root .bashrc if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/root/_bashrc"
|
||||||
|
dest: /root/.bashrc
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: '0644'
|
||||||
when:
|
become: true
|
||||||
- local_template_dir_root.stat.exists
|
when: bashrc_root_stat.stat.exists
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_bashrc')
|
|
||||||
tags:
|
tags:
|
||||||
- bash
|
- bash
|
||||||
|
|
||||||
|
|
||||||
# --
|
# --
|
||||||
# Copy .profile (Debian System)
|
# Copy .profile (Debian System)
|
||||||
# ---
|
# ---
|
||||||
@@ -109,22 +134,36 @@
|
|||||||
tags:
|
tags:
|
||||||
- profile
|
- profile
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .profile if it exists
|
|
||||||
copy:
|
# 1. Prüfen, ob für jeden User ein lokales _profile existiert
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_profile') }}"
|
- name: (users-systemfiles.yml) stat user _profile
|
||||||
dest: "~{{ item.item.name }}/.profile"
|
ansible.builtin.stat:
|
||||||
owner: "{{ item.item.name }}"
|
path: "{{ inventory_dir }}/files/homedirs/{{ item.name }}/_profile"
|
||||||
group: "{{ item.item.name }}"
|
delegate_to: localhost
|
||||||
mode: 0644
|
become: false
|
||||||
loop: "{{ local_template_dir_default_user.results }}"
|
loop: "{{ default_user }}"
|
||||||
|
register: profile_stats
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.item.name }}'
|
label: '{{ item.name }}'
|
||||||
|
|
||||||
|
# 2. Falls vorhanden, Datei kopieren
|
||||||
|
- name: (users-systemfiles.yml) copy .profile if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/{{ user.name }}/_profile"
|
||||||
|
dest: "~{{ user.name }}/.profile"
|
||||||
|
owner: "{{ user.name }}"
|
||||||
|
group: "{{ user.name }}"
|
||||||
|
mode: '0644'
|
||||||
|
loop: "{{ default_user | zip(profile_stats.results) | list }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ user.name }}"
|
||||||
when:
|
when:
|
||||||
- ansible_facts['distribution'] == "Debian"
|
- stat_result.stat.exists
|
||||||
- item.stat.exists
|
vars:
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_profile')
|
user: "{{ item.0 }}"
|
||||||
|
stat_result: "{{ item.1 }}"
|
||||||
tags:
|
tags:
|
||||||
- profile
|
- bash
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) Check if file '/root/.profile.ORIG' exists
|
- name: (users-systemfiles.yml) Check if file '/root/.profile.ORIG' exists
|
||||||
stat:
|
stat:
|
||||||
@@ -143,19 +182,27 @@
|
|||||||
tags:
|
tags:
|
||||||
- profile
|
- profile
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .profile for user root
|
|
||||||
copy:
|
# 1) Prüfen ob die _profile für root auf dem Control-Node existiert
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/root/_profile') }}"
|
- name: stat root _profile on control node
|
||||||
dest: "/root/.profile"
|
ansible.builtin.stat:
|
||||||
|
path: "{{ inventory_dir }}/files/homedirs/root/_profile"
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
register: profile_root_stat
|
||||||
|
|
||||||
|
# 2) Wenn vorhanden, kopieren wir sie nach /root/.profile auf dem Zielhost
|
||||||
|
- name: copy root .profile if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/root/_profile"
|
||||||
|
dest: /root/.profile
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: '0644'
|
||||||
when:
|
become: true
|
||||||
- ansible_facts['distribution'] == "Debian"
|
when: profile_root_stat.stat.exists
|
||||||
- local_template_dir_root.stat.exists
|
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_profile')
|
|
||||||
tags:
|
tags:
|
||||||
- profile
|
- bash
|
||||||
|
|
||||||
# --
|
# --
|
||||||
# Copy .bash_profile (CentOS/Fedora?/RedHat? System)
|
# Copy .bash_profile (CentOS/Fedora?/RedHat? System)
|
||||||
@@ -184,22 +231,39 @@
|
|||||||
tags:
|
tags:
|
||||||
- profile
|
- profile
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .bash_profile if it exists
|
|
||||||
copy:
|
# 1. Prüfen, ob für jeden User ein lokales _bash_profile existiert
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bash_profile') }}"
|
- name: (users-systemfiles.yml) stat user _bash_profile
|
||||||
dest: "~{{ item.item.name }}/.bash_profile"
|
ansible.builtin.stat:
|
||||||
owner: "{{ item.item.name }}"
|
path: "{{ inventory_dir }}/files/homedirs/{{ item.name }}/_bash_profile"
|
||||||
group: "{{ item.item.name }}"
|
delegate_to: localhost
|
||||||
mode: 0644
|
become: false
|
||||||
loop: "{{ local_template_dir_default_user.results }}"
|
loop: "{{ default_user }}"
|
||||||
|
register: bash_profile_stats
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.item.name }}'
|
label: '{{ item.name }}'
|
||||||
when:
|
when:
|
||||||
- ansible_facts['distribution'] == "CentOS"
|
- ansible_facts['distribution'] == "CentOS"
|
||||||
- item.stat.exists
|
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_bash_profile')
|
# 2. Falls vorhanden, Datei kopieren
|
||||||
|
- name: (users-systemfiles.yml) copy .bash_profile if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/{{ user.name }}/_bash_profile"
|
||||||
|
dest: "~{{ user.name }}/.bash_profile"
|
||||||
|
owner: "{{ user.name }}"
|
||||||
|
group: "{{ user.name }}"
|
||||||
|
mode: '0644'
|
||||||
|
loop: "{{ default_user | zip(bash_profile_stats.results) | list }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ user.name }}"
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "CentOS"
|
||||||
|
- stat_result.stat.exists
|
||||||
|
vars:
|
||||||
|
user: "{{ item.0 }}"
|
||||||
|
stat_result: "{{ item.1 }}"
|
||||||
tags:
|
tags:
|
||||||
- profile
|
- bash
|
||||||
|
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) Check if file '/root/.bash_profile.ORIG' exists
|
- name: (users-systemfiles.yml) Check if file '/root/.bash_profile.ORIG' exists
|
||||||
@@ -219,39 +283,66 @@
|
|||||||
tags:
|
tags:
|
||||||
- profile
|
- profile
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .bash_profile for user root
|
|
||||||
copy:
|
# 1) Prüfen ob die _bash_profile für root auf dem Control-Node existiert
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/root/_bash_profile') }}"
|
- name: stat root _bash_profile on control node
|
||||||
dest: "/root/.bash_profile"
|
ansible.builtin.stat:
|
||||||
owner: root
|
path: "{{ inventory_dir }}/files/homedirs/root/_bash_profile"
|
||||||
group: root
|
delegate_to: localhost
|
||||||
mode: 0644
|
become: false
|
||||||
|
register: bash_profile_root_stat
|
||||||
when:
|
when:
|
||||||
- ansible_facts['distribution'] == "CentOS"
|
- ansible_facts['distribution'] == "CentOS"
|
||||||
- local_template_dir_root.stat.exists
|
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_bash_profile')
|
# 2) Wenn vorhanden, kopieren wir sie nach /root/.bash_profile auf dem Zielhost
|
||||||
|
- name: copy root .bash_profile if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/root/_bash_profile"
|
||||||
|
dest: /root/.bash_profile
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
become: true
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "CentOS"
|
||||||
|
- bash_profile_root_stat.stat.exists
|
||||||
tags:
|
tags:
|
||||||
- profile
|
- bash
|
||||||
|
|
||||||
|
|
||||||
# --
|
# --
|
||||||
# Copy .vimrc
|
# Copy .vimrc
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .vimrc if it exists
|
# 1. Prüfen, ob für jeden User ein lokales _vimrc existiert
|
||||||
copy:
|
- name: (users-systemfiles.yml) stat user _vimrc
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_vimrc') }}"
|
ansible.builtin.stat:
|
||||||
dest: "~{{ item.item.name }}/.vimrc"
|
path: "{{ inventory_dir }}/files/homedirs/{{ item.name }}/_vimrc"
|
||||||
owner: "{{ item.item.name }}"
|
delegate_to: localhost
|
||||||
group: "{{ item.item.name }}"
|
become: false
|
||||||
mode: 0644
|
loop: "{{ default_user }}"
|
||||||
loop: "{{ local_template_dir_default_user.results }}"
|
register: vimrc_stats
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.item.name }}'
|
label: '{{ item.name }}'
|
||||||
|
|
||||||
|
# 2. Falls vorhanden, Datei kopieren
|
||||||
|
- name: (users-systemfiles.yml) copy .vimrc if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/{{ user.name }}/_vimrc"
|
||||||
|
dest: "~{{ user.name }}/.vimrc"
|
||||||
|
owner: "{{ user.name }}"
|
||||||
|
group: "{{ user.name }}"
|
||||||
|
mode: '0644'
|
||||||
|
loop: "{{ default_user | zip(vimrc_stats.results) | list }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ user.name }}"
|
||||||
when:
|
when:
|
||||||
- item.stat.exists
|
- stat_result.stat.exists
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/' + item.item.name + '/_vimrc')
|
vars:
|
||||||
|
user: "{{ item.0 }}"
|
||||||
|
stat_result: "{{ item.1 }}"
|
||||||
tags:
|
tags:
|
||||||
- vim
|
- bash
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) Check if .vim directory exists for default users
|
- name: (users-systemfiles.yml) Check if .vim directory exists for default users
|
||||||
local_action: stat path={{ inventory_dir }}/files/homedirs/{{ item.name }}/.vim
|
local_action: stat path={{ inventory_dir }}/files/homedirs/{{ item.name }}/.vim
|
||||||
@@ -275,18 +366,30 @@
|
|||||||
tags:
|
tags:
|
||||||
- vim
|
- vim
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) copy .vimrc for user root
|
# 1) Prüfen ob die _vimrc für root auf dem Control-Node existiert
|
||||||
copy:
|
- name: stat root _vimrc on control node
|
||||||
src: "{{ lookup('fileglob', inventory_dir + '/files/homedirs/root/_vimrc') }}"
|
ansible.builtin.stat:
|
||||||
dest: "/root/.vimrc"
|
path: "{{ inventory_dir }}/files/homedirs/root/_vimrc"
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
register: vimrc_root_stat
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "CentOS"
|
||||||
|
|
||||||
|
# 2) Wenn vorhanden, kopieren wir sie nach /root/.vimrc auf dem Zielhost
|
||||||
|
- name: copy root .vimrc if it exists
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ inventory_dir }}/files/homedirs/root/_vimrc"
|
||||||
|
dest: /root/.vimrc
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: '0644'
|
||||||
|
become: true
|
||||||
when:
|
when:
|
||||||
- local_template_dir_root.stat.exists
|
- ansible_facts['distribution'] == "CentOS"
|
||||||
- lookup('fileglob', inventory_dir + '/files/homedirs/root/_vimrc')
|
- vimrc_root_stat.stat.exists
|
||||||
tags:
|
tags:
|
||||||
- vim
|
- bash
|
||||||
|
|
||||||
|
|
||||||
- name: (users-systemfiles.yml) Check if local template directory .vim exists for user root
|
- name: (users-systemfiles.yml) Check if local template directory .vim exists for user root
|
||||||
|
|||||||
Reference in New Issue
Block a user