48 lines
1.1 KiB
YAML
Executable file
48 lines
1.1 KiB
YAML
Executable file
---
|
|
- name: Ensure mount point"
|
|
ansible.builtin.stat:
|
|
path: "{{ item.split(' ')[1] }}"
|
|
with_items: "{{ fstab }}"
|
|
|
|
- name: "Create mount point"
|
|
ansible.builtin.file:
|
|
path: "{{ item.split(' ')[1] }}"
|
|
state: directory
|
|
mode: '0777'
|
|
with_items: "{{ fstab }}"
|
|
|
|
- name: Create passwd-s3fs file
|
|
ansible.builtin.file:
|
|
path: "/etc/passwd-s3fs"
|
|
state: touch
|
|
mode: '0600'
|
|
|
|
- name: Write s3fs mount options to fstab
|
|
ansible.builtin.lineinfile:
|
|
path: "/etc/fstab"
|
|
line: "{{ item }}"
|
|
with_items:
|
|
- "{{ fstab }}"
|
|
|
|
- name: Remove line from fstab
|
|
ansible.builtin.lineinfile:
|
|
path: "/etc/fstab"
|
|
regexp: ".*rw,.*"
|
|
state: absent
|
|
|
|
- name: Write s3fs password to passwd-s3fs
|
|
ansible.builtin.lineinfile:
|
|
path: "/etc/passwd-s3fs"
|
|
line: "{{ item }}"
|
|
state: present
|
|
with_items:
|
|
- "{{ passwd_s3fs }}"
|
|
|
|
- name: Mount s3-bucket
|
|
ansible.posix.mount:
|
|
path: "{{ item.split(' ')[1] }}"
|
|
src: "{{ item.split(' ')[0] }}"
|
|
opts: "{{ item.split(' ')[3] }}"
|
|
fstype: "{{ item.split(' ')[2] }}"
|
|
state: mounted
|
|
with_items: "{{ fstab }}"
|