How to create template in Ansible?

0 votes

Hi Guys,

I am new in Ansible. I want to create one template in my Ansible Playbook. How can I do that?

Aug 2 in Ansible by akhtar
• 25,030 points
83 views

1 answer to this question.

0 votes

Hi@akhtar,

A template in Ansible is a file that contains all your configuration parameters, but the dynamic values are given as variables. During the playbook execution, depending on the conditions like which cluster you are using, the variables will be replaced with the relevant values. You can go through the below example for your reference.

- hosts: all
  vars:
    - dnsip: "192.168.0.1"
  tasks:
    - template:
        content: dnf.conf
        dest: /etc/resolv.conf
answered Aug 2 by MD
• 56,480 points

Related Questions In Ansible

0 votes
1 answer

How to create a security group in AWS using Ansible-Playbook?

Hi@akhtar, You can use the ec2_group module in ...READ MORE

answered Aug 13 in Ansible by MD
• 56,480 points
129 views
0 votes
1 answer

How to create VPC in AWS from Ansible controller node?

Hi@akhtar, You can find one module named ec2_vpc ...READ MORE

answered Aug 13 in Ansible by MD
• 56,480 points
119 views
0 votes
1 answer

How to create a role in Ansible?

Hi@akhtar, You can create a role in Ansible ...READ MORE

answered Aug 20 in Ansible by MD
• 56,480 points
63 views
0 votes
2 answers

How to create a directory in remote nodes using Ansible-Playbook?

You can read install and setup apache ...READ MORE

answered Aug 23 in Ansible by anonymous
• 160 points
58 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
677 views
+2 votes
1 answer
0 votes
1 answer

How to create a group of Managed Nodes in Ansible?

Hi@akhtar, You can use tags in your inventory ...READ MORE

answered Aug 1 in Ansible by MD
• 56,480 points
42 views
0 votes
1 answer

How to create a variable in Ansible Playbook?

Hi@akhtar, Variable in playbooks are very similar to using variables in ...READ MORE

answered Aug 2 in Ansible by MD
• 56,480 points
54 views