Files
ansible-role-checkmk-agent/tasks/downloads/samba/main.yml
2024-01-09 14:33:55 +13:00

54 lines
1.8 KiB
YAML

---
# These tasks will ensure the control node has the correct packages
# for talking Samba. And then download the required package files.
# Note: This is only to pull them to the control node.
#
# Still needs to be pushed to the guest
- name: Ensure Samba-related packages are installed.
package:
name: '{{ item }}'
state: present
become: true
with_items: [samba-client, cifs-utils]
delegate_to: localhost
- name: Ensure download path is present
file:
path: /tmp/dls
state: directory
delegate_to: localhost
- name: Set Facts
set_fact:
cmk_download_new: "{{ (cmk_download_path + '/' + cmk_installer) | reslash }}"
- name: Some Vars for debuggery
vars:
msg: |
CMK Download Path: {{ cmk_download_path }}
CMK Download Full: {{ cmk_download_new }}
CMK Installer: {{ cmk_installer }}
Username: {{ cmk_smb_username }}
Password: {{ cmk_smb_password }}
debug:
msg: "{{ msg.split('\n') }}"
when: cmk_debug
- name: Copy archive from samba_share. (No-Log)
command: >
smbget 'smb:{{ (cmk_download_path + '/' + cmk_installer) | reslash }}' -U
'{{ cmk_smb_username }}%{{ cmk_smb_password }}'
args:
chdir: /tmp/dls
creates: /tmp/dls/{{ cmk_installer }}
warn: false # Don't warn of other modules. I want to use smbget ;)
no_log: true # Turn off logging due to password exposure
when: not cmk_debug | bool
delegate_to: localhost
- name: Copy archive from samba_share. (Debug)
command: >
smbget 'smb:{{ (cmk_download_path + '/' + cmk_installer) | reslash }}' -U '{{ cmk_smb_username | trim }}%{{ cmk_smb_password | trim }}
args:
chdir: /tmp/dls
creates: /tmp/dls/{{ cmk_installer }}
warn: false # Don't warn of other modules. I want to use smbget ;)
no_log: false # Turn off logging due to password exposure
when: cmk_debug | bool
delegate_to: localhost