Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new module: filesize - create or resize a file, given its size #2232

Merged
merged 8 commits into from
Apr 19, 2021

Conversation

quidame
Copy link
Collaborator

@quidame quidame commented Apr 13, 2021

Moved from ansible-collections/ansible.posix#148

SUMMARY

New module filesize to create a file or resize it. This is a simple wrapper around dd that allows to grow or reduce (truncate) a file to any arbitrary size. Useful to manage swap files.

Supports check_mode and diff.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

filesize

ADDITIONAL INFORMATION

Example:

- name: create/resize a swap file
  filesize:
    path: /var/swap
    size: 2G
    mode: u=rw,go=
    group: root
    owner: root
  become: yes
  diff: yes

Copy link
Contributor

@aminvakil aminvakil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

plugins/modules/files/filesize.py Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
@ansibullbot

This comment has been minimized.

@ansibullbot ansibullbot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed community_review labels Apr 13, 2021
@quidame quidame requested a review from aminvakil April 13, 2021 23:07
@ansibullbot ansibullbot added community_review and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Apr 13, 2021
Copy link
Contributor

@aminvakil aminvakil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from (#2232 (comment)) LGTM.

I won't insist on this change though.

plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
@felixfontein felixfontein added the check-before-release PR will be looked at again shortly before release and merged if possible. label Apr 17, 2021
@quidame quidame marked this pull request as draft April 17, 2021 17:13
quidame and others added 3 commits April 17, 2021 21:39
* description: create or resize a file, given its size
* with integration tests
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Amin Vakil <info@aminvakil.com>
@quidame quidame marked this pull request as ready for review April 17, 2021 20:02
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I spotted a few more details, but besides that everything's great!

plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
plugins/modules/files/filesize.py Outdated Show resolved Hide resolved
quidame and others added 2 commits April 17, 2021 22:59
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein
Copy link
Collaborator

Assuming CI passes and nobody complains, I'll merge by Monday or so :)

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Apr 19, 2021
@felixfontein felixfontein merged commit f87a39b into ansible-collections:main Apr 19, 2021
@felixfontein
Copy link
Collaborator

@quidame thanks for contributing this!
@Andersson007 @aminvakil thanks for reviewing!

@quidame quidame deleted the new_module/filesize branch June 14, 2021 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants