part 1 Flashcards
what is ansible?
Ansible is an open-source automation tool used for managing and configuring computers. In simple terms, it’s like a remote control that allows you to easily set up, manage, and deploy software on multiple machines from a single point
what is a configuration file in ansible?
In Ansible, a configuration file is a file where you specify settings and parameters to control the behavior of Ansible. This file is usually named ansible.cfg
what is the default location of the ansible.cfg file?
/etc/ansible/ansible.cfg
what is the hierarchy in which ansible searches for the configuration file?
- ANSIBLE_CONFIG (environment variable): If the ANSIBLE_CONFIG environment variable is set, Ansible will use the file specified by this variable.
- ansible.cfg (in the current directory): If no environment variable is set, Ansible will look for a file named ansible.cfg in the directory where the Ansible command is run.
- .ansible.cfg (in the home directory): If no configuration file is found in the current directory, Ansible will look for a file named .ansible.cfg in the home directory of the user running the command.
- /etc/ansible/ansible.cfg: As a last resort, Ansible will use the global configuration file located at /etc/ansible/ansible.cfg.
-
what is the command to view which configuration file you’re currently using?
ansible-config view
In what file does ansible store information about the target servers?
inventory file
what are variables in ansible?
Variables in Ansible are used to store values that can be reused throughout your playbooks, roles, and tasks.
what are the different ways you can define a variable?
- in the inventory file
- in a playbook
- in a variable file
- in roles
etc….
how do you use a variable in ansible?
{{variable name}}
what is this {{ }} called ?
jinja2 templating
what are the different kinds of variables in ansible?
- string
- numbers
- boolean
- list (holds multiple string values)
- dictionary (holds a collection of key value pairs)
what are facts in ansible?
In Ansible, facts are pieces of information about the remote systems that are automatically collected by the setup module when a playbook is run.
what are some common facts ansible gathers about the target server?
network Information: IP addresses, network interfaces, etc.
System Information: Hostname, OS type, architecture, etc.
ansible_hostname
ansible_os_family
ansible_architecture
Hardware Information: CPU, memory, disks, etc.
all facts gathered by ansible are stored in ?
a variable called ansible_facts
what is an ansible playbook?
An Ansible playbook is a YAML file that defines a series of tasks to be executed on remote hosts.