From 2f78d46b9751864a9a6cdadc30ad0fde706e846a Mon Sep 17 00:00:00 2001 From: abregman Date: Sun, 26 Jan 2020 13:46:43 +0200 Subject: [PATCH] Add Ansible and Regex questions --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 30dd8ba..8197a6b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ :information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :) -:bar_chart:  There are currently **834** questions +:bar_chart:  There are currently **854** questions :warning:  You can use these for preparing for an interview but most of the questions and exercises don't represent an actual interview. Please read [Q&A](common-qa.md) for more details @@ -60,6 +60,7 @@ Testing
Testing
Databases
Databases
+ Regex
Beginner :baby:
Design
Design
you
Questions you ask
Exercises
Exercises
@@ -2166,6 +2167,14 @@ 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?
+
+What the "become" directive used for in Ansible?
+
+ +
+What are facts? How to see all the facts of a certain host?
+
+
What would be the result of the following play?
@@ -2184,7 +2193,7 @@ When given a written code, always inspect it thoroughly. If your answer is “th
-What would be the result of running the following task? +What would be the result of running the following task? How to fix it? ``` - hosts: localhost @@ -2205,6 +2214,18 @@ When given a written code, always inspect it thoroughly. If your answer is “th Explain the directory layout of an Ansible role
+
+What 'blocks' are used for in Ansible?
+
+ +
+How do you handle errors in Ansible?
+
+ +
+You would like to run a certain command if a task fails. How would you achieve that?
+
+
Write a playbook to install ‘zlib’ and ‘vim’ on all hosts if the file ‘/tmp/mario’ exists on the system.
@@ -2320,10 +2341,10 @@ A full list can be found at the link above. Also, note there is a significant di
Write a filter to capitalize a string
- +``` def cap(self, string): return string.capitalize() - +```
@@ -3616,7 +3637,7 @@ with open('file.txt', 'w') as file: Can you write a function which will print all the file in a given directory? including sub-directories
-#### Regex +#### Python Regex
How do you perform regular expressions related operations in Python? (match patterns, substitute strings, etc.)
@@ -6280,6 +6301,44 @@ A single data source (at least usually) which is stored in a raw format. What is OLAP (Online Analytical Processing)?
+## Regex + +Given a text file, perform the following exercises + +#### Extract + +
+Extract all the numbers
+
+ +
+Extract the first word of each line
+ +Bonus: extract the last word of each line +
+ +
+Extract all the IP addresses
+
+ +
+Extract dates in the format of yyyy-mm-dd or yyyy-dd-mm
+
+ +
+Extract email addresses
+
+ +#### Replace + +
+Replace tabs with four spaces
+
+ +
+Replace 'red' with 'green'
+
+ ## Design #### Architecture