Ansible Flashcards

1
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

[Ansible]
What flag limits the (ansible) playbook?

A

-l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

[Ansible]
How to run a YAML file on all host in stage inventory?

A

-l [specify inventory file]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

[Ansible]
Whats the name of the term/condition that only allows you to do things when certain conditions are met?

A

When

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

[Ansible]
What is ansible?
& how do you use it?

A

It is a configuration management tool, that allows us to automate repetitive tasks & ensure consistency across servers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

[Ansible]
[Get clarity on the best way to answer this]
What’s the difference between an ansible playbook, role, and task?

A

playbook= a YAML file containing plays (a set of tasks) that define the automation steps

role= a structured way to organize playbooks into smaller, reusable & more manageable units (contains task, variables, templates, file and handlers)

task= a single action that can executed on a remote system (example: installing a package or starting a service)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

[Ansible]
What flag runs the playbook but doesn’t apply it?

A

–check

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

[Ansible]
What flag limits the playbook to a specific host?

A

-l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

[Ansible]
How to run a playbook on all host in stage inventory?

A

-l [specify host]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

[Ansible]
What are the benefits of Ansible’s item potency?

A

Ansible checks the deltas & will only change things that need to be changed so that you can run it multiple times on the same system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

[Ansible] [Get clarity]
If installing a package & writing a task what Ansible module would you use?

A

YUM (RHEL7)
or
DNF (RHEL8)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

[Ansible] [Need clarity]
What is the general design of a playbook?

A

Starts with — to indicate a YAML document.

  • name: (of play)
    host: (target machines or group [from inventory file])
    become: (need to run play as root?)vars: (defines reusable names/values)
    package_name: (ie: httpd)tasks:
    - name: (name of task)
    Defines reusable values.
    Example:
    yaml
    Copy
    Edit
    vars:
    package_name: httpd
    Tasks (tasks)

The core of the playbook, executing actions using Ansible modules.
Example:
yaml
Copy
Edit
- name: Install Apache
yum:
name: httpd
state: present
Handlers (handlers)

Triggered by tasks (e.g., restart a service after configuration changes).
Example:
yaml
Copy
Edit
handlers:
- name: Restart Apache
systemd:
name: httpd
state: restarted
Roles (roles)

Organizes tasks, variables, templates, and handlers into reusable components.
Conditional Execution (when)

Runs tasks only if conditions are met.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

[Ansible]
How does Ansible leverage Jinga2?

A

for template processing and enables the dynamic insertion of data into files based on variables and logic defined in your playbooks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

[Ansible]
Typically, where is the main playbook stored?

A

/default

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

[Ansible]
Where are the variables for /etc/chrony.conf stored?

A

in main.yaml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

[Ansible]
Where are the templates stored?

A

in /etc/chrony.conf

17
Q

[Ansible]
What file controls all the configurations?

A

/main.yaml

18
Q

[Ansible]
What flag gives an in-depth breakdown of the play/processes being ran?

A

-v OR -vvv (verbose)

19
Q

[Ansible]
Where is the Ansible config file located?

A

/etc/ansible/ansible.cfg