You've already forked role-check-mk-agent
Add samba download option
This commit is contained in:
0
tasks/downloads/http/.gitkeep
Normal file
0
tasks/downloads/http/.gitkeep
Normal file
61
tasks/downloads/samba/main.yml
Normal file
61
tasks/downloads/samba/main.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
# 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
|
||||
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
|
||||
Reference in New Issue
Block a user