Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible backup file name

Tags:

linux

ansible

When I copy a file with ansible it backups file(wrote backup=yes). My question is about filename that is default created by ansible.

config.xml.6634.2018-05-22@17:52:12~

What does 6634 means in this filename?

like image 604
Rauf Aliyev Avatar asked May 31 '18 07:05

Rauf Aliyev


People also ask

What is recurse in ansible?

recurse. boolean. added in 1.1 of ansible.builtin. Recursively set the specified file attributes on directory contents. This applies only when state is set to directory .

What is Remote_src?

remote_src. boolean. added in 2.0 of ansible.builtin. Influence whether src needs to be transferred or already is present remotely. If no , it will search for src on the controller node.

Does ansible copy use SCP?

If you want to copy a file from an Ansible Control Master to remote hosts, the COPY (scp) module would be just fine.

What is the scope of Ansible backups?

To be on the same page, let me explain what I’m referring to: the scope of Ansible backups is any file copied or created from a template in Ansible playbook. So we’re not talking about magical backups of Ansible playbooks or Ansible config files, just the files deployed by Ansible in a certain way.

What to do when deploying configuration files with Ansible?

One important thing to do when deploying configuration files with Ansible is to always keep backups, that’s what I’m going to document today. To be on the same page, let me explain what I’m referring to: the scope of Ansible backups is any file copied or created from a template in Ansible playbook.

How to copy files from remote source to local in Ansible?

You can use the fetch module to copy files from the remote source to local on the other hand. We will be seeing various examples of Ansible copy in this article. we have one more article on Ansible copy for you to read and explore.

How to backup and restore PostgreSQL databases with Ansible?

Backup and restore PostgreSQL databases with Ansible There are multiple ways to backup and restore a database. With PostgreSQL we can either use SQL dumps or Continuous Archiving and Point-in-Time Recovery. This post is about the simple and straighforward SQL dumps, automated using Ansible.


1 Answers

It's the process ID of the remote Ansible process, as can be seen here in the source code:

            ext = time.strftime("%Y-%m-%d@%H:%M:%S~", time.localtime(time.time()))
            backupdest = '%s.%s.%s' % (fn, os.getpid(), ext)
                                           ^^^^^^^^^^^

This added in this commit (Ansible 2.2.0.0) to improve the odds that the generated filename is unique, probably in case two Ansible processes try to overwrite the same file within the same second.

like image 182
Thomas Avatar answered Oct 21 '22 04:10

Thomas