feat: remove SSHFS task inclusion and delete sshfs.yml file
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
This commit is contained in:
parent
b669a8c2c9
commit
8e1b3cdf8a
@ -7,10 +7,6 @@
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Include SSHFS tasks
|
||||
ansible.builtin.include_tasks: sshfs.yml
|
||||
when: ansible_hostname == "mennos-cloud-server"
|
||||
|
||||
- name: Include services tasks
|
||||
ansible.builtin.include_tasks: services/services.yml
|
||||
vars:
|
||||
|
@ -1,52 +0,0 @@
|
||||
- name: Configure SSHFS
|
||||
block:
|
||||
- name: Get SSHFS credentials via local lookup
|
||||
delegate_to: localhost
|
||||
ansible.builtin.set_fact:
|
||||
sshfs_user: "{{ lookup('community.general.onepassword', '5j5y5axfjr3f3sn5nixb6htg4y', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='username') }}"
|
||||
sshfs_pass: "{{ lookup('community.general.onepassword', '5j5y5axfjr3f3sn5nixb6htg4y', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='password') }}"
|
||||
sshfs_host: "{{ lookup('community.general.onepassword', '5j5y5axfjr3f3sn5nixb6htg4y', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='host') }}"
|
||||
sshfs_port: 23
|
||||
remote_path: /mnt/storage-box
|
||||
|
||||
- name: Install SSHFS package
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: sshfs
|
||||
state: present
|
||||
|
||||
- name: Create mount point directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ remote_path }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Create credentials file for SSHFS
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
content: "username={{ sshfs_user }}\npassword={{ sshfs_pass }}"
|
||||
dest: /etc/sshfs-credentials
|
||||
mode: '0600'
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Add fstab entry for SSHFS
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/fstab
|
||||
line: "sshfs#{{ sshfs_user }}@{{ sshfs_host }}: {{ remote_path }} fuse.sshfs credentials=/etc/sshfs-credentials,port={{ sshfs_port }},reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,uid=1000,gid=1000,_netdev 0 0"
|
||||
state: present
|
||||
regexp: "^sshfs#.*{{ remote_path }}"
|
||||
backup: true
|
||||
register: fstab_update
|
||||
notify: Systemctl daemon-reload
|
||||
|
||||
- name: Mount filesystems
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: "mount -a"
|
||||
register: mount_result
|
||||
changed_when: mount_result.rc == 0
|
||||
failed_when: mount_result.rc != 0
|
||||
when: fstab_update.changed
|
Loading…
x
Reference in New Issue
Block a user