34 lines
900 B
YAML
Executable File
34 lines
900 B
YAML
Executable File
---
|
|
- name: SMB Credentials auf Zielhosts erzeugen
|
|
hosts: all
|
|
become: false
|
|
gather_facts: false
|
|
ignore_unreachable: yes
|
|
|
|
vars_files:
|
|
- ../group_vars/all/smb_credentials.yaml
|
|
|
|
vars:
|
|
credentials_file: "/root/.smbcredentials2"
|
|
|
|
tasks:
|
|
- name: SMB Credentials Datei erzeugen
|
|
ansible.builtin.copy:
|
|
dest: "{{ credentials_file }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0600"
|
|
content: |
|
|
username={{ smb_user }}
|
|
password={{ smb_pass }}
|
|
register: cred_file
|
|
|
|
- name: Prüfen ob die Credentials Datei existiert
|
|
ansible.builtin.stat:
|
|
path: "{{ credentials_file }}"
|
|
register: cred_stat
|
|
|
|
- name: "Debug: Status der Credentials Datei"
|
|
ansible.builtin.debug:
|
|
msg: "SMB Credentials existieren: {{ cred_stat.stat.exists }}"
|
|
when: cred_stat is defined and cred_stat.stat is defined |