Ansible Concepts Flashcards

1
Q

what is the parameter ansible_host?

A

“ansible_host” is a inventory parameter, that is used to specify the host IP address or the FQDN

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

List all the ansible inventory parameters?

A

ansible_host - IP address of the host
ansible_connection - ssh/winrm/localhost
ansible_port - 29/5986
ansible_user - root/administrator
ansible_ssh_pass - Password

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

In what format are the ansible playbooks written in?

A

YAML. A playbook is a single YAML file containing a set of plays

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

What is a play in Ansible playbook?

A

Play defines a set of activities (tasks) to be performed on a hosts or group of hosts

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

What is a task (activity) in the definition of play in playbook?

A

Task is an action to be performed in a host or group of hosts. Eg.
Execute a command
Run a script
Install a package
Shutdown/restart

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

Can you give an example of a playbook.yaml file?

A
  • name: play1
    host: localhost
    tasks:
    • name: Execute command ‘date’
      command: date
    • name: Execute this script on the server
      script: test_script.sh
    • name: Install httpd server
      yum:
      name: httpd
      state: present
    • name: start web server
      service:
      name: httpd
      state: started
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the relation between the inventory file and the playbook.yml file?

A

The host name entered in the inventory file must match the host key value in the playbook yaml file

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

How do you execute an ansible playbook?

A

ansible-playbook <playbook>
eg. ansible-playbook playbook.yaml</playbook>

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

what are the 4 importants ansible concepts?

A

Ansible Inventory
Ansible playbooks
Ansible module
Ansible variables

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

List some examples of Ansible Modules?

A

system
command
files
database
cloud
windows

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

what is command module used for?

A

Command module is used to execute scripts, and run commands

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

what is service module used for?

A

Maintaining the services in the system, like starting stopping

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

What are variables in ansible?

A

Variables are used to store information that varies with each host

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