Ansible Galaxy is a hub for finding, sharing, and downloading Ansible roles and collections.
In Ansible, `include` is used to include a file dynamically during playbook execution, allowing for conditional inclusion, while `import` is used to statically include a file at the time of playbook parsing, meaning it is always included regardless of conditions.
Idempotency in Ansible means that running a playbook multiple times will produce the same result each time, with no changes made unless there is a need to update the system.
You can test Ansible playbooks locally by using `localhost` in your inventory file or by specifying `connection: local` in your playbook.
Callbacks in Ansible are plugins that allow you to customize the output format or logging of Ansible runs, such as sending notifications to Slack or formatting the output in a specific way.
You can include another playbook in your playbook using the `import_playbook` directive.
Tags in Ansible are labels that you can assign to tasks or plays in a playbook, allowing you to run or skip specific parts of the playbook during execution.
A handler in Ansible is a special type of task that runs only when it is notified by another task, typically used to perform actions like restarting a service after a configuration change.
You can run only one task from a playbook using `–start-at-task="task name"` or by using `–tags` with a specific tag assigned to that task.
The "shell" module allows you to run shell commands and supports shell features like pipes and redirection, while the "command" module runs commands without a shell, so it does not support shell features.
You can encrypt sensitive data in Ansible using Ansible Vault by running the command `ansible-vault encrypt <file>` to encrypt files or `ansible-vault encrypt_string '<string>'` to encrypt individual strings.
In Ansible:
– **vars**: These are variables defined in a playbook or role that can be used throughout the playbook. They have the highest precedence.
– **defaults**: These are default variables defined in a role's `defaults/main.yml` file. They have lower precedence than regular vars and are overridden by them.
– **environment variables**: These are variables set in the environment where Ansible runs. They can be accessed in playbooks but have the lowest precedence compared to vars and defaults.
Ansible facts are system information collected from remote nodes, such as IP address, operating system, memory, and more, using the setup module.
The default location of the inventory file is /etc/ansible/hosts.
A module in Ansible is a reusable, standalone script that performs a specific task, such as managing system resources, executing commands, or configuring services.
An inventory file in Ansible is a file that defines the hosts and groups of hosts on which Ansible will operate. It specifies the target machines for automation tasks and can be in INI or YAML format.
A Playbook in Ansible is a YAML file that defines a set of tasks to be executed on specified hosts, allowing for the automation of configuration management, application deployment, and orchestration.
A Playbook in Ansible is a YAML file that defines a series of tasks to be executed on managed hosts, specifying the configuration, deployment, and orchestration of applications and systems.
Ansible works by using a push-based model to automate tasks on remote systems. It connects to target machines over SSH (or WinRM for Windows) and executes modules, which are small programs that perform specific tasks. Ansible uses playbooks, written in YAML, to define the desired state of the systems and the steps needed to achieve that state. It does not require an agent to be installed on the target machines, making it lightweight and easy to use.
Ansible is an open-source automation tool used for configuration management, application deployment, and task automation, allowing users to manage systems and applications in a simple and efficient way using playbooks written in YAML.