Ansible Pilot

Ansible Configuration File ansible.cfg for OpenSSH SCP Option

A Deep Dive into Ansible’s Custom Configuration for Secure File Transfers

October 4, 2023
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons


Ansible is a powerful open-source automation tool used for configuration management, application deployment, and task automation. It simplifies the management of complex IT infrastructure by allowing you to define tasks and configurations as code. One crucial aspect of Ansible’s functionality is its configuration file, ansible.cfg. This file serves as a central point for configuring various settings and options for Ansible. In this article, we will explore the content of a sample ansible.cfg file and explain its key sections.

OpenSSH Security Implications

It’s important to note that the following sample ansible.cfg file mentioned a change in OpenSSH since Red Hat Enterprise Linux (RHEL) 9 onward regarding the deprecation of the SCP protocol. This change has significant security implications:

The Best Resources For Ansible


Video Course

Printed Book


Understanding ansible.cfg

The ansible.cfg file is a plain text configuration file that can be used to customize Ansible’s behavior. It provides a way to override default settings and adapt Ansible to specific use cases and environments. The file is typically located in the /etc/ansible/ directory on a Linux system. However, you can also create a custom ansible.cfg file in your project directory to apply configuration settings specifically to that project.

In this article, we’ll dissect a sample ansible.cfg file to understand its different sections and the options it contains.

Sample ansible.cfg File

ssh_args            = -F /dev/null -o ControlMaster=auto -o ControlPersist=60s
transfer_method     = scp
scp_extra_args      = -O
scp_if_ssh          = True

Key Sections and Options


The ansible.cfg file is vital to Ansible’s configuration, allowing users to tailor the tool to their specific needs. While this article primarily focused on the ansible.cfg file’s content, it’s crucial to stay informed about changes in related technologies, such as the deprecation of the SCP protocol since Red Hat Enterprise Linux 9 onward, to ensure the security and efficiency of your automation workflows. Customizing Ansible’s configuration, as well as adapting to changes in underlying protocols, is essential for effective automation and system management.

Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.


Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases