From 4e05b9de224d2455a69300cc2f1b1c6a6c7257c0 Mon Sep 17 00:00:00 2001 From: abregman Date: Fri, 17 Jan 2020 19:30:55 +0200 Subject: [PATCH] Add a couple of Ansible questions --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 94688dd..faa4686 100644 --- a/README.md +++ b/README.md @@ -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 + + +
+What kind of automation you wouldn't do with Ansible and why?
@@ -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 +```
@@ -2138,7 +2145,10 @@ spun up and shut down, without you tracking every change in these sources.
-You want to run Ansible playbook only on specific minor version of your OS, how would you achieve that?
+How do you list all modules and how can you see details on a specific module?

+ +1. Ansible online docs +2. `ansible-doc -l` for list of modules and `ansible [module_name]` for detailed information on a specific module
@@ -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 ```
+
+You want to run Ansible playbook only on specific minor version of your OS, how would you achieve that?
+
+
What would be the result of the following play?
@@ -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.
+
+What would be the result of running the following task? + +``` +- hosts: localhost + tasks: + - name: Install zlib + package: + name: zlib + state: present +``` +
+
+
Which Ansible best practices are you familiar with?. Name at least three
+
+Explain the directory layout of an Ansible role
+
+
Write a playbook to install ‘zlib’ and ‘vim’ on all hosts if the file ‘/tmp/mario’ exists on the system.
@@ -2263,7 +2295,19 @@ A full list can be found at the link above. Also, note there is a significant di
-What is ansible-pull? How it’s different compared to ansible-playbook?
+What is ansible-pull? How is it different from how ansible-playbook works?
+
+ +
+What is Ansible Vault?
+
+ +
+Demonstrate each of the following with Ansible: + + * Conditionals + * Loops +
@@ -2282,6 +2326,10 @@ def cap(self, string):
+
+You would like to run a task only if previous task changed anything. How would you achieve that?
+
+
How do you test your Ansible based projects?