yadro.tatlin_uni.tatlin_sp_resource_file module – Create or modify a file resource

Note

This module is part of the yadro.tatlin_uni collection (version 1.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install yadro.tatlin_uni.

To use it in a playbook, specify: yadro.tatlin_uni.tatlin_sp_resource_file.

New in version 1.0.0: of yadro.tatlin_uni

Synopsis

  • This module is intended to create new file resource/resources and change existing resource/resources

  • Multiple resources can be created at once with name_template (For Tatlin>=2.7 only)

  • Supports check mode

Parameters

Parameter

Comments

connection

dictionary / required

connection describes Tatlin Storage Processor (SP) connection configuration.

Only session connection supported.

Authorization is executed automatically with corresponding endpoint. ‘auth/login’ by default.

Client receives x-auth-token and uses it for following requests.

base_url

string / required

Tatlin REST API entrypoint.

password

string

Tatlin user password.

timeout

integer

Tatlin REST API request timeout.

Default: 60

username

string

Tatlin username to login.

validate_certs

boolean

Responsible for SSL certificates validation.

If set to False certificates won’t validated.

Choices:

  • no

  • yes ← (default)

name

string / required

Name of the resource

name_template

string

Template for bulk mode creation.

Possible formats - ‘1-3’, ‘1-3,4,7-10’, ‘0-99’

Example - with name_template=’1-3’ and name=’res_’ 3 resources with names ‘res_1’, ‘res_2’, ‘res_3’ will be created

Not supported in Tatlin<=2.7

pool

string / required

Name of the pool that includes the resource

ports

list / elements=string

List of names of the ports for export resources

read_cache

boolean

Cache reading

Required for creating a new resource

Choices:

  • no

  • yes

size

string

Resource volume

Required if new resource is creating

Not allowed for changing

Can be presented as a string number with postfix For example ‘100 MiB’. Following postfixes are allowed - [B, KB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB]

If no postfix is passed, ‘B’ (bytes) will be used

subnets

list / elements=string

List of names of the subnets for export resources

type

string / required

Type of the file resource

Choices:

  • cifs

  • nfs

user_groups

list / elements=dictionary

List of names of the user groups for export resources with corresponding permissions

name

string / required

Name of the user group

permissions

string / required

User group`s permissions

Choices:

  • r

  • rw

users

list / elements=dictionary

List of names of the users for export resources with corresponding permissions

name

string / required

Name of the user

permissions

string / required

User`s permissions

Choices:

  • r

  • rw

wait

boolean

Wait until resource or resources will be created or changed

If false, there is no guarantee that task will be successfully completed

Irrelevant for bulk resources changing

Choices:

  • no

  • yes ← (default)

wait_timeout

integer

Number of seconds to wait when wait=true

Default: 300

write_cache

boolean

Cache writing

Required for creating a new resource

Choices:

  • no

  • yes

Examples

---
- name: Set single resource
  yadro.tatlin_uni.tatlin_sp_resource_file:
    connection: "{{ connection }}"
    name: example_resource
    pool: example_pool
    type: nfs
    size: 100 MiB
    read_cache: true
    write_cache: true
    ports:
      - p00
      - p01
    subnets:
      - example_subnet1
      - example_subnet2
    users:
      - name: example_user1
        permissions: rw
      - name: example_user2
        permissions: r
    user_groups:
      - name: example_user_group1
        permissions: r
      - name: example_user_group2
        permissions: rw

- name: Set multiple resources
  yadro.tatlin_uni.tatlin_sp_resource_file:
    connection: "{{ connection }}"
    name: example_resource
    name_template: 1-3,5,7-8
    pool: example_pool
    type: nfs
    size: 100 MiB
    read_cache: true
    write_cache: true
    ports:
      - p00
      - p01
    subnets:
      - example_subnet1
      - example_subnet2
    users:
      - name: example_user1
        permissions: rw
      - name: example_user2
        permissions: r
    user_groups:
      - name: example_user_group1
        permissions: r
      - name: example_user_group2
        permissions: rw

- name: Change single resource
  yadro.tatlin_uni.tatlin_sp_resource_file:
    connection: "{{ connection }}"
    name: example_resource
    pool: example_pool
    type: nfs
    read_cache: false
    write_cache: false
    ports:
      - p10
    subnets:
      - example_subnet2
      - example_subnet3
    users:
      - name: example_user2
        permissions: rw
      - name: example_user3
        permissions: r
    user_groups:
      - name: example_user_group2
        permissions: r
      - name: example_user_group3
        permissions: rw

- name: Change multiple resources
  yadro.tatlin_uni.tatlin_sp_resource_file:
    connection: "{{ connection }}"
    name: example_resource
    name_template: 1-100
    pool: example_pool
    type: nfs
    read_cache: false
    write_cache: false
    ports:
      - p10
    subnets:
      - example_subnet2
      - example_subnet3
    users:
      - name: example_user2
        permissions: rw
      - name: example_user3
        permissions: r
    user_groups:
      - name: example_user_group2
        permissions: r
      - name: example_user_group3
        permissions: rw

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed_resources

list / elements=string

Names of the changed resources

Returned: on success

created_resources

list / elements=string

Names of the created resources

Returned: on success

error

string

Error details if raised

Returned: on error

msg

string

Operation status message

Returned: always

Authors

  • Sergey Kovalev (@kvlvs)