626 questions
0
votes
1
answer
109
views
How to prevent templating on variables in Ansible? [duplicate]
My Ansible playbook looks like below:
- hosts: all
gather_facts: false
remote_user: ansadm
vars:
dashboard_json: {This is some sample text in JSON with numerous data in curly braces {{Text}}...
0
votes
0
answers
262
views
How to use Ansible Automation Platform/Playbook with HashiVault and an approle
Here's what I want to do. I use credentials that I've stored in AAP to access HashiVault, I want to create a playbook that uses those credentials to get what I want from HashiVault.
But everything I ...
0
votes
1
answer
66
views
Trying to combine lines using TextFSM
I'm trying to figure out a textfsm parser to process cisco ios object-lists for use with an Ansible playbook task. (Background: There isn't an ios module for object-groups, so I'm trying to do this ...
1
vote
1
answer
290
views
Managing Nginx vHost Conf Files with Ansible
I'm new to the automation world and I'm stuck trying to figure out how I can automate and maintain Nginx conf files for the vhost I manage using Ansible.
For example, normally I would create a conf ...
0
votes
1
answer
62
views
Ansible, Custom Fact - 'VARIABLE IS NOT DEFINED!: ''ogg_fact_general'' is undefined
Ansible custom facts, defined in /etc/ansible/facts.d. I can get their values manually just fine, like so:
[root@lnx000 templates]# ansible lnx072 -m ansible.builtin.setup | grep ogg_fact
...
-2
votes
2
answers
94
views
How to use only one variable out of 3 based on condition in ansible?
I have three variables to be register based on condition, it will run one task and register one variable, how can i use testing variable for respective task ?
---
- name: Test1
command: "echo ...
-3
votes
1
answer
334
views
AnsibleUnsafeText object' has no attribute 'hostname' [closed]
I am receiving the below error if I use set_fact and {% if %} {% else %} statements in my playbook.
FAILED! => {"msg": "The task includes an option with an undefined variable. The ...
1
vote
1
answer
168
views
Passing a dict to the vars variable in a task in ansible errors
I have the following ansible code:
```
- name: Install and configure PGS servers for RZ
hosts: pgs_rzdb_servers
tasks:
- name: Prepare pgs_server role variables
set_fact:
...
0
votes
1
answer
131
views
how to extract ps command in Ansible results in a list
- name: Check running processes
shell: ps aux | grep -i "[t]omcat"
register: tomcat_process_cmd
The result of the ps aux | grep ... command is (wrapped for readability):
tomcat ...
2
votes
2
answers
92
views
My Host vars and Group vars are not loading
This is my ansible.cfg at the root of the project.
[defaults]
inventory = ./ansible/inventory/staging
This is my content of staging inventory
[all_hosts]
rails ansible_ssh_host=170.64.208.17
[...
0
votes
1
answer
41
views
The variables in ansible playbook doesn't persist between iterations in Jinja for loop
I can't understand why the list of list elements doesn't change between the iterations of a for loop inside the Jinja template.
For example, playbook:
- name: Create Config Files
hosts: localhost
...
1
vote
3
answers
407
views
Is there a way to build up a single string from a list of values using standard Ansible/Jinja2 templating syntax?
I have a variable that looks something like this:
files:
- a.yaml
- b.yaml
- c.yaml
Using the ansible.builtin.template module, I'd like to build a file which contains the following string:
...
2
votes
2
answers
442
views
Ansible task that ends all plays defined in playbook yaml file
To start with I am using:
ansible --version
ansible [core 2.16.3]
config file = None
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']...
1
vote
1
answer
463
views
Loop item in Ansible TASK description?
I have a requirement were I want to use loop to create connector for kafka. I want to use table list and want to use config that will create configs for kafka connectors. For example (this is random ...
-1
votes
2
answers
411
views
Ansible: environment variables not exported when using sudo in shell command [duplicate]
I am facing issues in exporting environment variables as part of the following Ansible task -
- name: Run custom shell script
shell: "sudo bash custom_script.sh"
register: output
...
1
vote
1
answer
1k
views
Merge two YAML files with ansible.builtin.include_vars and combine
I am trying to merge these two YAML file together:
vars/standard_x.yaml:
---
paas_id: "aze8ea"
paas_name: "test"
components:
- name: paas_registration
- name: argos
size: s
...
0
votes
2
answers
306
views
Render numbers inside an Ansible yaml template
Very close to Create an int var with Ansible's ternary operator and that answer https://stackoverflow.com/a/69109779/446302
In an Ansible project, I'm trying to have a yaml template file with ...
1
vote
1
answer
2k
views
Ansible template: Skip if there is no difference to existing file
actually i'm getting into Ansible and writing my first ever playbook, which does some general setup on my linux servers when i got them.
I am trying to get a Jinja2 template to apply, but only if the ...
1
vote
1
answer
230
views
Ansible: Creating multiple files using a template from a dictionary
I am trying to create multiple files via templates using elements from a dictionary to populate those files.
My goal is to create configuration files for proftpd for each of my uploading groups. Each ...
0
votes
2
answers
169
views
Rundeck install plugins with Ansible
I am using ansible yaml file to create rundeck jobs.
I want to create another job, but there I have to use Http Notification plugin.
I can install plugin manually from rundeck UI.
But is there any ...
-1
votes
1
answer
1k
views
Create multiple files from the same Jinja2 Template using values from a var file
I need to create multiple files with values declared in a var file from a Jinja2 Template file (server.properties). I have tried known methods to implement the file generation but the problem is only ...
0
votes
1
answer
129
views
How to create variables in Ansible where the number increments?
I am writing an Ansible task where it installs a set of LDAP entries with the following objectClass and attributes and values.
dn: entry=101,cn=multicast,{{ ipa_base }}
objectClass: multicastAddress
...
0
votes
1
answer
344
views
How to loop through a list with another list that contains a dictionary
I'm having some trouble with an Ansible Playbook I'm working on. I'm using the vm_hardware_disk_module in order to create multiple virtual disks on a specific VM in a specific vCenter.
This is the ....
0
votes
1
answer
173
views
Return updated unsorted dict in Ansible
I am trying to merge some dicts with saving their items on their own places like it is working in python using dict.update(), but i have some troubles with it in Ansible.
For example, I have two dicts:...
0
votes
1
answer
431
views
How can I replace a value of dictionary based on a key condition in values.yaml via Ansible playbook?
I have a values.yaml file and I want to update the particular value of a dictionary based on its key.
For Example
input.yaml
env:
- name: "namespace1"
value: "abc"
- name: "...