1672353480
This tutorial presents Ansible step-by-step. You'll need to have a (virtual or physical) machine to act as an Ansible node. A Vagrant environment is provided for going through this tutorial.
Ansible is a configuration management software that lets you control and configure nodes from another machine. What makes it different from other management software is that Ansible uses (potentially existing) SSH infrastructure, while others (Chef, Puppet, ...) need a specific PKI infrastructure to be set up.
Ansible also emphasizes push mode, where configuration is pushed from a master machine (a master machine is only a machine where you can SSH to nodes from) to nodes, while most other CM typically do it the other way around (nodes pull their config at times from a master machine).
This mode is really interesting since you do not need to have a 'publicly' accessible 'master' to be able to configure remote nodes: it's the nodes that need to be accessible (we'll see later that 'hidden' nodes can pull their configuration too!), and most of the time they are.
This tutorial has been tested with Ansible 2.9.
We're also assuming you have a keypair in your ~/.ssh directory.
vagrant up
The reference is the installation guide, but I strongly recommend the Using pip & virtualenv (higly recommended !) method.
The best way to install Ansible (by far) is to use pip
and virtual environments.
Using virtualenv will let you have multiple Ansible versions installed side by side, and test upgrades or use different versions in different projects. Also, by using a virtualenv, you won't pollute your system's python installation.
Check virtualenvwrapper for this. It makes managing virtualenvs very easy.
Under Ubuntu, installing virtualenv & virtualenvwrapper can be done like so:
sudo apt install python3-virtualenv virtualenvwrapper python3-pip
exec $SHELL
You can then create a virtualenv:
mkvirtualenv ansible-tuto
workon ansible-tuto
(mkvirtualenv
usually switches you automatically to your newly created virtualenv, so here workon ansible-tuto
is not strictly necessary, but lets be safe).
Then, install ansible via pip
:
pip install ansible==2.7.1
(or use whatever version you want).
When you're done, you can deactivate your virtualenv to return to your system's python settings & modules:
deactivate
If you later want to return to your virtualenv:
workon ansible-tuto
Use lsvirtualenv
to list all your virtual environments.
Ansible devel branch is always usable, so we'll run straight from a git checkout. You might need to install git for this (sudo apt-get install git
on Debian/Ubuntu).
git clone git://github.com/ansible/ansible.git
cd ./ansible
At this point, we can load the Ansible environment:
source ./hacking/env-setup
sudo apt-get install ansible
When running from an distribution package, this is absolutely not necessary. If you prefer running from an up to date Debian package, Ansible provides a make target
to build it. You need a few packages to build the deb and few dependencies:
sudo apt-get install make fakeroot cdbs python-support python-yaml python-jinja2 python-paramiko python-crypto python-pip
git clone git://github.com/ansible/ansible.git
cd ./ansible
make deb
sudo dpkg -i ../ansible_x.y_all.deb (version may vary)
git clone https://github.com/leucos/ansible-tuto.git
cd ansible-tuto
You can run the tutorials here interactively including a very simple setup with docker.
Check this repository for details.
It's highly recommended to use Vagrant to follow this tutorial. If you don't have it already, setting up should be quite easy and is described in step-00/README.md.
If you wish to proceed without Vagrant (not recommended!), go straight to step-01/README.md.
Just in case you want to skip to a specific step, here is a topic table of contents.
Thanks to all people who have contributed to this tutorial:
(and sorry if I forgot anyone)
I've been using Ansible almost since its birth, but I learned a lot in the process of writing it. If you want to jump in, it's a great way to learn, feel free to add your contributions.
The chapters being written live in the writing branch.
If you have ideas on topics that would require a chapter, please open a PR.
I'm also open on pairing for writing chapters. Drop me a note if you're interested.
If you make changes or add chapters, please fill the test/expectations
file and run the tests (test/run.sh
). See the test/run.sh
file for (a bit) more information.
When adding a new chapter (e.g. step-NN
), please issue:
cd step-99
ln -sf ../step-NN/{hosts,roles,site.yml,group_vars,host_vars} .
For typos, grammar, etc... please send a PR for the master branch directly.
Thank you!
Author: leucos
Source Code: https://github.com/leucos/ansible-tuto
License: View license
1596728880
In this tutorial we’ll learn how to begin programming with R using RStudio. We’ll install R, and RStudio RStudio, an extremely popular development environment for R. We’ll learn the key RStudio features in order to start programming in R on our own.
If you already know how to use RStudio and want to learn some tips, tricks, and shortcuts, check out this Dataquest blog post.
[tidyverse](https://www.dataquest.io/blog/tutorial-getting-started-with-r-and-rstudio/#tve-jump-173bb26184b)
Packages[tidyverse](https://www.dataquest.io/blog/tutorial-getting-started-with-r-and-rstudio/#tve-jump-173bb264c2b)
Packages into Memory#data science tutorials #beginner #r tutorial #r tutorials #rstats #tutorial #tutorials
1599097440
A famous general is thought to have said, “A good sketch is better than a long speech.” That advice may have come from the battlefield, but it’s applicable in lots of other areas — including data science. “Sketching” out our data by visualizing it using ggplot2 in R is more impactful than simply describing the trends we find.
This is why we visualize data. We visualize data because it’s easier to learn from something that we can see rather than read. And thankfully for data analysts and data scientists who use R, there’s a tidyverse package called ggplot2 that makes data visualization a snap!
In this blog post, we’ll learn how to take some data and produce a visualization using R. To work through it, it’s best if you already have an understanding of R programming syntax, but you don’t need to be an expert or have any prior experience working with ggplot2
#data science tutorials #beginner #ggplot2 #r #r tutorial #r tutorials #rstats #tutorial #tutorials
1596513720
What exactly is clean data? Clean data is accurate, complete, and in a format that is ready to analyze. Characteristics of clean data include data that are:
Common symptoms of messy data include data that contain:
In this blog post, we will work with five property-sales datasets that are publicly available on the New York City Department of Finance Rolling Sales Data website. We encourage you to download the datasets and follow along! Each file contains one year of real estate sales data for one of New York City’s five boroughs. We will work with the following Microsoft Excel files:
As we work through this blog post, imagine that you are helping a friend launch their home-inspection business in New York City. You offer to help them by analyzing the data to better understand the real-estate market. But you realize that before you can analyze the data in R, you will need to diagnose and clean it first. And before you can diagnose the data, you will need to load it into R!
Benefits of using tidyverse tools are often evident in the data-loading process. In many cases, the tidyverse package readxl
will clean some data for you as Microsoft Excel data is loaded into R. If you are working with CSV data, the tidyverse readr
package function read_csv()
is the function to use (we’ll cover that later).
Let’s look at an example. Here’s how the Excel file for the Brooklyn borough looks:
The Brooklyn Excel file
Now let’s load the Brooklyn dataset into R from an Excel file. We’ll use the readxl
package. We specify the function argument skip = 4
because the row that we want to use as the header (i.e. column names) is actually row 5. We can ignore the first four rows entirely and load the data into R beginning at row 5. Here’s the code:
library(readxl) # Load Excel files
brooklyn <- read_excel("rollingsales_brooklyn.xls", skip = 4)
Note we saved this dataset with the variable name brooklyn
for future use.
The tidyverse offers a user-friendly way to view this data with the glimpse()
function that is part of the tibble
package. To use this package, we will need to load it for use in our current session. But rather than loading this package alone, we can load many of the tidyverse packages at one time. If you do not have the tidyverse collection of packages, install it on your machine using the following command in your R or R Studio session:
install.packages("tidyverse")
Once the package is installed, load it to memory:
library(tidyverse)
Now that tidyverse
is loaded into memory, take a “glimpse” of the Brooklyn dataset:
glimpse(brooklyn)
## Observations: 20,185
## Variables: 21
## $ BOROUGH <chr> "3", "3", "3", "3", "3", "3", "…
## $ NEIGHBORHOOD <chr> "BATH BEACH", "BATH BEACH", "BA…
## $ `BUILDING CLASS CATEGORY` <chr> "01 ONE FAMILY DWELLINGS", "01 …
## $ `TAX CLASS AT PRESENT` <chr> "1", "1", "1", "1", "1", "1", "…
## $ BLOCK <dbl> 6359, 6360, 6364, 6367, 6371, 6…
## $ LOT <dbl> 70, 48, 74, 24, 19, 32, 65, 20,…
## $ `EASE-MENT` <lgl> NA, NA, NA, NA, NA, NA, NA, NA,…
## $ `BUILDING CLASS AT PRESENT` <chr> "S1", "A5", "A5", "A9", "A9", "…
## $ ADDRESS <chr> "8684 15TH AVENUE", "14 BAY 10T…
## $ `APARTMENT NUMBER` <chr> NA, NA, NA, NA, NA, NA, NA, NA,…
## $ `ZIP CODE` <dbl> 11228, 11228, 11214, 11214, 112…
## $ `RESIDENTIAL UNITS` <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1…
## $ `COMMERCIAL UNITS` <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `TOTAL UNITS` <dbl> 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1…
## $ `LAND SQUARE FEET` <dbl> 1933, 2513, 2492, 1571, 2320, 3…
## $ `GROSS SQUARE FEET` <dbl> 4080, 1428, 972, 1456, 1566, 22…
## $ `YEAR BUILT` <dbl> 1930, 1930, 1950, 1935, 1930, 1…
## $ `TAX CLASS AT TIME OF SALE` <chr> "1", "1", "1", "1", "1", "1", "…
## $ `BUILDING CLASS AT TIME OF SALE` <chr> "S1", "A5", "A5", "A9", "A9", "…
## $ `SALE PRICE` <dbl> 1300000, 849000, 0, 830000, 0, …
## $ `SALE DATE` <dttm> 2020-04-28, 2020-03-18, 2019-0…
The glimpse()
function provides a user-friendly way to view the column names and data types for all columns, or variables, in the data frame. With this function, we are also able to view the first few observations in the data frame. This data frame has 20,185 observations, or property sales records. And there are 21 variables, or columns.
#data science tutorials #beginner #r #r tutorial #r tutorials #rstats #tidyverse #tutorial #tutorials
1596584126
In my previous role as a marketing data analyst for a blogging company, one of my most important tasks was to track how blog posts performed.
On the surface, it’s a fairly straightforward goal. With Google Analytics, you can quickly get just about any metric you need for your blog posts, for any date range.
But when it comes to comparing blog post performance, things get a bit trickier.
For example, let’s say we want to compare the performance of the blog posts we published on the Dataquest blog in June (using the month of June as our date range).
But wait… two blog posts with more than 1,000 pageviews were published earlier in the month, And the two with fewer than 500 pageviews were published at the end of the month. That’s hardly a fair comparison!
My first solution to this problem was to look up each post individually, so that I could make an even comparison of how each post performed in their first day, first week, first month, etc.
However, that required a lot of manual copy-and-paste work, which was extremely tedious if I wanted to compare more than a few posts, date ranges, or metrics at a time.
But then, I learned R, and realized that there was a much better way.
In this post, we’ll walk through how it’s done, so you can do my better blog post analysis for yourself!
To complete this tutorial, you’ll need basic knowledge of R syntax and the tidyverse, and access to a Google Analytics account.
Not yet familiar with the basics of R? We can help with that! Our interactive online courses teach you R from scratch, with no prior programming experience required. Sign up and start today!
You’ll also need the dyplr
, lubridate
, and stringr
packages installed — which, as a reminder, you can do with the install.packages()
command.
Finally, you will need a CSV of the blog posts you want to analyze. Here’s what’s in my dataset:
post_url
: the page path of the blog post
post_date
: the date the post was published (formatted m/d/yy)
category
: the blog category the post was published in (optional)
title
: the title of the blog post (optional)
Depending on your content management system, there may be a way for you to automate gathering this data — but that’s out of the scope of this tutorial!
For this tutorial, we’ll use a manually-gathered dataset of the past ten Dataquest blog posts.
#data science tutorials #promote #r #r tutorial #r tutorials #rstats #tutorial #tutorials
1667747700
A collaborative curated list of awesome Ansible resources, tools, Roles, tutorials and other related stuff.
Ansible is an open source toolkit, written in Python, it is used for configuration management, application deployment, continuous delivery, IT infrastructure automation and automation in general.
Official resources by and for Ansible.
Places where to chat with the Ansible community
Tutorials and courses to learn Ansible.
Books about Ansible.
Video tutorials and Ansible training.
Tools for and using Ansible.
Best practices and other opinions on Ansible.
Awesome production ready Playbooks, Roles and Collections to get you up and running.
Author: ansible-community
Source Code: https://github.com/ansible-community/awesome-ansible
License: CC0-1.0 license