Add a couple of Ansible questions

This commit is contained in:
abregman 2020-01-17 19:30:55 +02:00
parent ee6c25e006
commit 4e05b9de22

View File

@ -2109,6 +2109,11 @@ Ansible is:
* Agent-less
* Minimal run requirements (Python & SSH) and simple to use
* Default mode is "push" (it supports also pull)
* Focus on simpleness and ease-of-use
</b></details>
<details>
<summary>What kind of automation you wouldn't do with Ansible and why?</summary><br><b>
</b></details>
<details>
@ -2118,6 +2123,7 @@ An inventory file defines hosts and/or groups of hosts on which Ansible tasks ex
An example of inventory file:
```
192.168.1.2
192.168.1.3
192.168.1.4
@ -2126,6 +2132,7 @@ An example of inventory file:
190.40.2.20
190.40.2.21
190.40.2.22
```
</b></details>
<details>
@ -2138,7 +2145,10 @@ spun up and shut down, without you tracking every change in these sources.
</b></details>
<details>
<summary>You want to run Ansible playbook only on specific minor version of your OS, how would you achieve that?</summary><br><b>
<summary>How do you list all modules and how can you see details on a specific module?</summary><br><br>
1. Ansible online docs
2. `ansible-doc -l` for list of modules and `ansible [module_name]` for detailed information on a specific module
</b></details>
<details>
@ -2147,11 +2157,15 @@ spun up and shut down, without you tracking every change in these sources.
```
- name: Create a new directory
file:
path: "/tmp/new_directory"
state: directory
path: "/tmp/new_directory"
state: directory
```
</b></details>
<details>
<summary>You want to run Ansible playbook only on specific minor version of your OS, how would you achieve that?</summary><br><b>
</b></details>
<details>
<summary>What would be the result of the following play?</summary><br><b>
@ -2169,10 +2183,28 @@ spun up and shut down, without you tracking every change in these sources.
When given a written code, always inspect it thoroughly. If your answer is “this will fail” then you are right. We are using a fact (ansible_hostname), which is a gathered piece of information from the host we are running on. But in this case, we disabled facts gathering (gather_facts: no) so the variable would be undefined which will result in failure.
</b></details>
<details>
<summary>What would be the result of running the following task?
```
- hosts: localhost
tasks:
- name: Install zlib
package:
name: zlib
state: present
```
</summary><br><b>
</b></details>
<details>
<summary>Which Ansible best practices are you familiar with?. Name at least three</summary><br><b>
</b></details>
<details>
<summary>Explain the directory layout of an Ansible role</summary><br><b>
</b></details>
<details>
<summary>Write a playbook to install zlib and vim on all hosts if the file /tmp/mario exists on the system.</summary><br><b>
@ -2263,7 +2295,19 @@ A full list can be found at the link above. Also, note there is a significant di
</b></details>
<details>
<summary>What is ansible-pull? How its different compared to ansible-playbook?</summary><br><b>
<summary>What is ansible-pull? How is it different from how ansible-playbook works?</summary><br><b>
</b></details>
<details>
<summary>What is Ansible Vault?</summary><br><b>
</b></details>
<details>
<summary>Demonstrate each of the following with Ansible:
* Conditionals
* Loops
</summary><br><b>
</b></details>
<a name="ansible-advanced"></a>
@ -2282,6 +2326,10 @@ def cap(self, string):
</code>
</b></details>
<details>
<summary>You would like to run a task only if previous task changed anything. How would you achieve that?</summary><br><b>
</b></details>
<details>
<summary>How do you test your Ansible based projects?</summary><br><b>
</b></details>