• Home
  • Ansible
  • About
  • Index
My Daily Tutorials

Ansible

  • Ansible

How to create files in Ansible

Posted on February 6, 2018November 17, 2019by Ansible admin

Creating new files is a pretty standard task in server scripts. In Ansible there are multiple methods to create new empty files.  You can also set different permissions, different group permissions, set the owner of the file, create files with content in them etc. Let us go through some ways in which it can be […]

Read More
  • Ansible

Replacing Strings and Lines in Ansible

Posted on February 5, 2018April 27, 2018by Ansible admin

There are multiple ways in which you can replace a particular word, a line, all the words matching a specific pattern etc. in Ansible. Depending on the situation we can use the Ansible ‘replace’ module or ‘lineinfile’ module. In this post, we will see some examples of how to use these modules to get the desired […]

Read More
1 Comment
  • Ansible

How to split strings and join them in A​nsibl​e

Posted on November 8, 2017April 27, 2018by Ansible admin

Split commands are useful when you need to divide a large line or a block of lines into a list. The dividing character will be specified in the command itself. So we can split when every ‘space’ character occurs, semicolon appears, a digit occurs etc. Join command is useful when you want values in a […]

Read More
  • Ansible

How to uncomment/comment lines in files using Ansible

Posted on November 1, 2017April 27, 2018by Ansible admin

Uncommenting or commenting a line is usually a task of just adding character or removing a character at the front; Unless it is a block comment. Let us see a few ways of dealing with single line comments in Ansible. Commenting a line in Ansible using replace module Replace module in Ansible is used to […]

Read More
3 Comments
  • Ansible

How to check if a file/directory exists in Ansible

Posted on October 28, 2017April 27, 2018by Ansible admin

To get the details of a file or directory in a Linux system, we can use the Ansible stat module. It works similar to the Linux ‘stat’ command. Of course, the module provides much more detail than whether a file exists or not. We can know when the file was last modified, what all permissions […]

Read More
  • Ansible

How to Create a Directory in Ansible

Posted on October 4, 2017April 27, 2018by Ansible admin

You will need to create directories or folders in Ansible many times during may of the DevOps process. Although you could do create directories using shell or command module, ansible provides a better and safer method for creating directories using the ‘file’ module. Ansible Directory Creation example To create a directory using the file module, […]

Read More
  • Ansible

Working with Ansible User Module

Posted on October 3, 2017April 27, 2018by Ansible admin

Ansible user module helps us to manage user accounts in Linux systems including creating user accounts, deleting them, setting passwords, adding groups to each user, etc. How to create users in Ansible Let us first see how to write a basic task for creating a Linux user using the Ansible user module. There is only […]

Read More
  • Ansible
  • ...
    • Tutorials

Using grep commands in Ansible tasks

Posted on September 29, 2017April 27, 2018by Ansible admin

Grep command is used on Linux/Unix to search for a particular pattern in a list of files. There is no Ansible grep module, but you can use the grep commands along with shell module or command module. We can store the results of the task and use it in various conditional statements, print them or use […]

Read More
  • Ansible

Working with Ansible filters

Posted on August 27, 2017April 27, 2018by Ansible admin

You can use Ansible filters when you need to format data inside template expressions. You are provided with a set of filters that are shipped with Ansible and another set provided by Jinja2 template engine. You can also build your own filters. In the following sections, I will give a list of useful filters and […]

Read More
  • Ansible

User inputs with Ansible Prompt with examples

Posted on August 27, 2017April 27, 2018by Ansible admin

Working with Ansible Prompts. Sometimes you need input from the user to decide how the playbook should run. Maybe you need to name a directory. Maybe there are plays written for installing multiple versions. And you can install one version based on the user input. Or there may be some data which is sensitive you […]

Read More

Posts navigation

Older posts

Mydailytutorials.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com.

Recent Posts

  • How to create files in Ansible
  • Replacing Strings and Lines in Ansible
  • Working with Ansible yum module
  • Ansible Pip Module – Managing Python Packages
  • Working with Environment​ Variables in Ansible

Categories

  • Ansible
  • Linux
  • Tutorials
Mydailytutorials.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Theme by Colorlib Powered by WordPress