https://github.com/archf/ansible-role-fs_setup
Configure filesystems and disks using an input compatible with cloud-init
https://github.com/archf/ansible-role-fs_setup
ansible-role
Last synced: 8 months ago
JSON representation
Configure filesystems and disks using an input compatible with cloud-init
- Host: GitHub
- URL: https://github.com/archf/ansible-role-fs_setup
- Owner: archf
- Created: 2020-01-27T20:47:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-27T20:48:11.000Z (over 6 years ago)
- Last Synced: 2025-10-29T07:03:58.395Z (8 months ago)
- Topics: ansible-role
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ansible-fs_setup
A role to create filesystems and to partition block devices
## Ansible requirements
### Ansible version
Minimum required ansible version is 2.8.
### Ansible role dependencies
None.
## Installation
### Install with Ansible Galaxy
```shell
ansible-galaxy install archf.fs_setup
```
Basic usage is:
```yaml
- hosts: all
roles:
- role: archf.fs_setup
```
### Install with git
If you do not want a global installation, clone it into your `roles_path`.
```shell
git clone git@github.com:archf/ansible-fs_setup.git /path/to/roles_path
```
But I often add it as a submdule in a given `playbook_dir` repository.
```shell
git submodule add git@github.com:archf/ansible-fs_setup.git /roles/fs_setup
```
As the role is not managed by Ansible Galaxy, you do not have to specify the
github user account.
Basic usage is:
```yaml
- hosts: all
roles:
- role: fs_setup
```
## User guide
### Requirements
None.
### Introduction
A simple role to configure filesystems using an input compatible with
`cloud-init` `fs_setup` or `disk_setup` module.
See [cloud-init](https://cloudinit.readthedocs.io/en/latest/topics/examples.html#create-partitions-and-filesystems)
documentation.
### Usage
## Role Variables
Variables are divided in three types.
The [default vars](#default-vars) section shows you which variables you may
override in your ansible inventory. As a matter of fact, all variables should
be defined there for explicitness, ease of documentation as well as overall
role manageability.
The [mandatory variables](#mandatory-variables) section contains variables that
for several reasons do not fit into the default variables. As name implies,
they must absolutely be defined in the inventory or else the role will
fail. It is a good thing to avoid reach for these as much as possible and/or
design the role with clear behavior when they're undefined.
The [context variables](#context-variables) are shown in section below hint you
on how runtime context may affects role execution.
### Default vars
Role default variables from `defaults/main.yml`.
```yaml
# Print extra debug information.
debug: false
# Global defaults for fs_setup. Can be overriden on a per filesystem
# basis.
# Default filesystem type to create.
fs_default_filesystem: 'ext4'
# Overwrite existing filesystems. Use with caution.
fs_replace_fs: false
# Default behavior is to mount the created filesystems.
fs_mount_state: mounted
# Default mount opts and passno.
fs_mount_opts: "defaults"
fs_mount_passno: 0
# Default filesystem owner/group/mode.
fs_owner: root
fs_group: root
fs_mode: "0755"
# cloud-init format extended with mount/perms options. see
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html#create-partitions-and-filesystems.
# added mount options are:
# - state (defaults to 'fs_mount_state')
# - owner (defaults to 'fs_owner')
# - group (defaults to 'fs_group')
# - path (path where to mount the filesystem which are always mounted by label)
# - mount_opts (defaults to 'fs_mount_opts')
# - mount_passno (defaults to 'fs_mount_passno')
# - mode (defaults to 'fs_mode')
fs_setup:
- label: hdfs-data01
filesystem: 'xfs'
device: '/dev/vdb1'
path: /opt/data01
mount_opts: noatime
mount_passno: 0
mode: '0755'
- label: hdfs-data02
filesystem: 'xfs'
device: '/dev/vdb2'
path: /opt/data02
mount_opts: noatime
- label: hdfs-data03
filesystem: 'xfs'
device: '/dev/vdb3'
path: /opt/data03
mount_opts: noatime
- label: hdfs-data04
filesystem: 'xfs'
device: '/dev/vdb4'
path: /opt/data04
mount_opts: noatime
# Global defaults for disk_setup. Can be overriden on a per partition basis.
# Print current partition information.
disk_state: info
# Default 'table_type'.
disk_table_type: 'gpt'
# cloud-init format partionning scheme.
# Notes:
# - table_type is consumed by the parted module 'label' arg.
# => supported values: [ aix, amiga, bsd, dvh, gpt, loop, mac, msdos, pc98, sun ]
# => defaults to gpt''
disk_setup:
vdb:
# table_type: 'gpt'
state: present
layout:
- [0, 25]
- [25, 50]
- [50, 75]
- [75, 100]
# overwrite: false
```
### Mandatory variables
None.
### Context variables
None.
## License
BSD.
## Author Information
Felix Archambault.
---
Please do not edit this file. This role `README.md` was generated using the
'ansidoc' python tool available on pypi!
*Installation:*
```shell
pip3 install ansidoc
```
*Basic usage:*
Validate output by running a dry-run (will output result to stdout)
```shell
ansidoc --dry-run
```
Generate you role readme file. Will write a `README.md` file under
`/README.md`.
```shell
ansidoc
```
Also usable programatically from Sphinx.