Creating Playbooks Flashcards

1
Q

How does each playbook start?

A

- name: Name of the Playbook

a descriptive label that helps to understand what the playbook is designed to do

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

How to specify that playbook should be executed on all hosts included in the hosts file?

A

hosts: ALL

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

How to specify that tasks will be executed on the local machine, not on the remote hosts?

A

connection: local

common when interacting with network devices using APIs

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

How to specify that the script should not gather any information about the host during the script execution?

A

gather_facts: False
can speed up playbook execution

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

How to specify the path to the Python interpreter that Ansible should use?

A
  vars:
    ansible_python_interpreter: /opt/homebrew/bin/python3.11
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to specify that paloaltonetworks.panos collections should be used?

A
  collections:
    - paloaltonetworks.panos
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What defines actions that will be executed in a playbook? How are the actions executed?

A

` tasks:`

each task is a step in the playbook, and will be executed in order

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

How to load the variables?

A
  tasks:
  - name: Load Variable
    include_vars: vars.yml

create it as a task with the include_vars module

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

In order to avoid potential errors, when should be the variables file loaded?

A

as the first task

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

If collection paloaltonetworks.panos is included in a playbook, how should be the module for security rules defined in tasks, instead of paloaltonetworks.panos.panos_security_rule?

A

panos_security_rule:

Ansible looks in paloaltonetworks.panos collection for the modules that are referenced in the tasks

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

How to ensure that IP addresses of hosts are used in a playbook from the inventory file?

A
provider:
  ip_address: "{{ inventory_hostname }}"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where can be the provider dictionary used?

A

either in file with variables or directly in the playbook

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

How do you define the hosts file that includes the IP addresses the playbook connects to?

A
[ALL]
10.200.1.4
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to run an Ansible playbook?

A
ansible-playbook {playbook}.yml -i {inventory_file}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly