Skip to content

noobient/ansible-galaxy-file_changed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noobient.file_changed

Synopsys

This role lets you detect changes in files between operations, so that you can indicate changes if, and only if, the file actually changed. This is useful when you do ad-hoc commands (command, shell, etc.) that cannot indicate if changes have been made or not.

Parameters

Name Required Example Description
path yes /etc/acme/foobar.com/foobar.com.cer File to check changes on.
mode yes before Indicate whether the check is before or after the command(s). Possible values are before and after. If before, it calculates the checksum, if after, it checks the current checksum with the one calculated during the before run, and indicates the change if they differ.
verbose no true If true, print more diagnostic messages. Defaults to false.

Examples

- include_role:
    name: noobient.file_changed
  vars:
    path: /etc/acme/foobar.com/foobar.com.cer
    mode: before

- name: Do stuff on file
  command:
    cmd: /opt/acme.sh --install-cert -d foobar.com --cert-file /etc/acme/foobar.com/foobar.com.cer
  changed_when: false

- include_role:
    name: noobient.file_changed
  vars:
    path: /etc/foo.conf
    mode: after
    verbose: true

Return Values

Key Type Example Description
file_changed.changed boolean true Indicates whether the file changed between the before and after runs. In before mode, it's always false.

Support

Platform Support Status
Linter Lint
AlmaLinux 8 AlmaLinux 8
AlmaLinux 9 AlmaLinux 9
Fedora 40 Fedora 40
Fedora 41 Fedora 41
Ubuntu 20.04 Ubuntu 20.04
Ubuntu 22.04 Ubuntu 22.04
Ubuntu 24.04 Ubuntu 24.04

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published