mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-27 22:37:21 +00:00
57 lines
1.7 KiB
YAML
57 lines
1.7 KiB
YAML
---
|
|
- hosts: "meta-name_fs01"
|
|
remote_user: skylight-rundeck
|
|
become: yes
|
|
gather_facts: false
|
|
vars_files:
|
|
- ../vars/common.yml
|
|
vars:
|
|
credentials_file: "/root/windows-envs/.{{ os_project }}-{{ win_project }}-smbcredentials"
|
|
tasks:
|
|
- name: Configure
|
|
tags: configure_mount
|
|
block:
|
|
- name: Create the mount point
|
|
file:
|
|
path: "/mnt/windows/{{ os_project }}-{{ win_project }}"
|
|
state: directory
|
|
mode: "0770"
|
|
owner: sg-transfer
|
|
group: sg-transfer
|
|
delegate_to: filetransfer
|
|
|
|
- name: Create credential file
|
|
file:
|
|
path: "{{ credentials_file }}"
|
|
state: touch
|
|
owner: root
|
|
group: root
|
|
mode: '0600'
|
|
delegate_to: filetransfer
|
|
|
|
- name: Write username into the credentials file
|
|
lineinfile:
|
|
path: "{{ credentials_file }}"
|
|
line: username=file-transfer@{{ win_project }}.loc
|
|
create: yes
|
|
delegate_to: filetransfer
|
|
|
|
- name: Write password into the credentials file
|
|
lineinfile:
|
|
path: "{{ credentials_file }}"
|
|
line: password="{{ transfer_user_password }}"
|
|
create: yes
|
|
delegate_to: filetransfer
|
|
|
|
- name: Mount Data
|
|
tags: mount_data
|
|
block:
|
|
- name: Mount filesystem on os-transfer
|
|
ansible.posix.mount:
|
|
src: "//{{ hostvars[inventory_hostname].ansible_host }}/File_Transfer"
|
|
path: "/mnt/windows/{{ os_project }}-{{ win_project }}"
|
|
opts: "credentials={{ credentials_file }},iocharset=utf8"
|
|
state: mounted
|
|
fstype: cifs
|
|
delegate_to: filetransfer
|