Questions tagged [yaml]

YaML is a human-readable data serialisation format.

YAML is a data serialisation format designed to be written and read by humans. Modern YAML is a superset of JSON, meaning that YAML parsers can consume any valid JSON as well as the richer and more human-friendly long form.

For more information refer to the YAML Wikipedia page or the YAML homepage.

92 questions
3
votes
2 answers

How to pass a group value in inventory file to jinja2 template file in ansible

I have an inventory file named hospital.inventory and it contains following group with a single value. [dockerSwarmManager] hp2-3.mydomain.com Then I have a file name security.json.j2 inside the folder call templates. In there I want to refer above…
AnujAroshA
  • 213
  • 1
  • 3
  • 7
2
votes
1 answer

How can I enable epel-release before installing packages with cloud-init?

I'm trying to install a few packages on CentOS 8 via cloud-init, like this: package_upgrade: true packages: - firewalld - htop One of them one of them requires epel-release repo to be installed first: No match for argument: htop 2019-10-21…
Chef Tony
  • 401
  • 1
  • 3
  • 8
2
votes
1 answer

How to use Ansible modules replace or inline instead shell command with SED

i have file with string: MYAPP.db.username.DEV=MYUSERNAME Where: MYAPP mean name of applications DEV means environment MYUSERNAME means name of user for connection to db I need to replace these variables according to variables, that i have in some…
Piduna
  • 541
  • 4
  • 12
  • 25
2
votes
2 answers

SaltStack: found conflicting ID

My sls file: /etc/sudoers.d/foo: file.managed: - contents: | foo ALL = NOPASSWD: /usr/bin/systemctl restart minio_storage-foo.service foo ALL = NOPASSWD: /bin/systemctl restart minio_storage-foo.service - template: jinja -…
guettli
  • 3,591
  • 17
  • 72
  • 123
2
votes
1 answer

Ansible error: The tasks/main.yml file for role 'common' must contain a list of tasks

I inherited this ansible git from my predecessor. I can't get it to work though and I guess it's something basic that I'm missing. It keeps giving me this lovely error: ERROR! The tasks/main.yml file for role 'common' must contain a list of…
Frank Vermeulen
  • 157
  • 2
  • 8
2
votes
1 answer

Unable to delete daemonSet in k8s

I've created a daemonSet in k8s under the namespace kube-system. While trying to delete the deamonSet it got stuck (also when I force it) I've already tried to set a updateStrategy: RollingUpdate To the Yaml and kubectl apply reports that:…
2
votes
1 answer

Create JSON Patch 6902 from two yaml/json files

Imagine I have a file foo.yaml and a modified version of this file called foo2.yaml. Is there a way to create a correspondig json patch 6902?
guettli
  • 3,591
  • 17
  • 72
  • 123
2
votes
1 answer

How to validate variables contents in Ansible?

ansible-lint only checks the tasks/handlers and doesn't iterate over the variables (e.g. if you're using with_items, it won't iterate over all the items) and yamllint only checks cosmetic issues and is hard to customized with custom rules. Is there…
gtirloni
  • 5,746
  • 3
  • 25
  • 52
2
votes
1 answer

patroni.exceptions.PatroniFatalException: 'Failed to bootstrap cluster'

I have a problem with patroni right here [postgres@localhost ~]$ patroni /etc/patroni.yml 2021-05-25 11:39:56,767 INFO: Selected new etcd server http://10.102.196.138:2379 2021-05-25 11:39:56,772 INFO: No PostgreSQL configuration items changed,…
2
votes
1 answer

AWS CloudFormation - Creating Layer Version and Function that uses layer

I have a Cloudformation template that currently looks roughly like the following. Resources: MyLayer: Type: AWS::Lambda::LayerVersion Properties: CompatibleRuntimes: - nodejs12.x - nodejs10.x Content:…
2
votes
1 answer

Use lookup/dynamic variable names in Ansible jinja2 template

The playbook below should generate a file with the content: a,b ssh_host_key ssh_rsa_host_key However, the way I construct the variable names results in either syntax/templating errors or 'variable name does not exists': --- - hosts: localhost …
Willem
  • 177
  • 4
  • 13
2
votes
0 answers

Puppet - Get interface name from netplan yaml config

How to get interface name which has nameservers defined? I want to get the interface name so I can pass it to another netplan puppet module so the nameservers can be replaced. But I only want to get the interface name (ens160) which has nameservers…
user630702
  • 495
  • 10
  • 32
1
vote
1 answer

pod's name from an environment variables defined in yaml

how can I create a yaml file for pod that get its name from a environment variables defined in yaml file. I have tried this but it is not allowed. metadata: generateName: $(HOSTNAME) . . . env: - name: HOSTNAME valueFrom: …
esxzawq
  • 121
  • 1
  • 11
1
vote
1 answer

Templated dict keys in ansible YAML

I am trying to use a dict in an Ansible task, which is defined like this: in vars/main.yml file: username: user1 userpass: pass1 users: "{{ username }}": pass: "{{ userpass }}" This doesn't work in Ansible 2.9: Ansible seems to not…
1
vote
1 answer

Puppet parse hiera in inline_template

I have got some .yaml hiera file with: iptables::test: ip: 1.1.1.1 : 'adm-1' 2.2.2.2 : 'adm-2' 3.3.3.3 : 'adm-3' And i want to parse this file in inline_template. I write: $variable1 = hiera('iptables::test.ip') $variable2 =…
perrfect
  • 65
  • 1
  • 7