2025-05-10 12:02:00 +00:00

3.5 KiB

Worker Playbooks

How to run any playbook?

To execute the playbook, run the following command:

./run_ansible_playbook.sh <playbook>

Set Up SMB Access: smb.yaml

Overview

This Ansible playbook is designed to set up SMB (Server Message Block) access to the remote directories on a group of worker nodes. It automates the creation of necessary directories, configuration of filesystem mounts, and management of credential files to facilitate secure access to shared resources.

Features

  • Directory Creation: The playbook creates essential directories, including:

    • .cred: A directory for storing credential files.
    • remote-apps: A directory for accessing remote applications.
    • Media: A directory for media files.
  • File Management: It copies the SMB access file into the .cred directory, ensuring that the necessary credentials are available for mounting the SMB shares.

  • Fstab Configuration: The playbook adds entries to the /etc/fstab file for both the remote-apps and Media directories. This ensures that the SMB shares are automatically mounted at boot time.

  • Disk Mounting: Finally, it executes the mount -a command to mount all filesystems listed in the fstab, making the shared resources immediately available for use.

Requirements

  • The playbook requires elevated privileges (sudo) to perform tasks such as creating directories and modifying system files.
  • It relies on variables defined in external YAML files (worker_vars.yaml and common_vars.yaml) for configuration parameters such as paths and usernames.

Usage tags

create
  • This tag is used for tasks that involve the creation of directories. It allows for the selective execution of all tasks that set up new directories in the specified paths.
directory
  • This tag specifically identifies tasks that create directories. It can be used to run all directory-related tasks in the playbook, ensuring that the necessary directory structure is established.
cred
  • This tag is associated with tasks that pertain to the .cred directory and its contents. It is useful for executing tasks related to credential management, particularly those that involve creating or modifying the .cred directory.
remote_apps
  • This tag is used for tasks that relate to the remote-apps directory and its configuration. It allows for the execution of tasks that set up or modify the remote-apps directory, including entries in the fstab file.
media
  • This tag is associated with tasks that involve the Media directory. It can be used to run tasks that create or configure the Media directory, ensuring that it is properly set up for use.
copy
  • This tag is used for tasks that involve copying files. It allows for the execution of tasks that transfer files to specific locations, such as copying the SMB access file to the .cred directory.
fstab
  • This tag is associated with tasks that modify the /etc/fstab file. It is useful for executing tasks that add or update entries in the fstab, which is critical for managing filesystem mounts.
mount
  • This tag is used for tasks that involve mounting filesystems. It allows for the execution of tasks that perform mounting operations, such as running the mount -a command to mount all filesystems listed in fstab.
disks
  • This tag is specifically related to tasks that deal with disk mounting. It can be used to run tasks that ensure all specified disks are mounted correctly, facilitating access to the necessary filesystems.