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.

86 questions
8
votes
2 answers

quoting colon in ansible

I am trying to use ansible to check that the output of a particular program is set to a certain value. That value includes a colon followed by a space, and this seems to register as a syntax error no matter how I quote it. example: --- - hosts:…
stochastic
  • 306
  • 1
  • 2
  • 6
6
votes
2 answers

How to merge variables of type hash across different variable files in ansible?

I have two YAML variable files which are reused for many playbooks: # playbook/group_vars/all settings: a: 1 b: 2 # inventory/group_vars/main.yml settings: c: 3 I want settings to be equal { a: 1, b: 2, c: 3 } in my playbooks. Instead it…
Jason Holcomb
  • 63
  • 1
  • 5
5
votes
2 answers

Is it possible to change the current user's password in-band with ansible?

I have a Linux distribution that is freshly installed. It has a regular user with a default password, and a locked down root account (no password on root - can't be SSHed as directly). I want to be able to run an ansible playbook to configure this…
Tal
  • 295
  • 1
  • 4
  • 11
5
votes
3 answers

Get current hostname and push it into conf file with ansible

I'm working into an ansible playbook to get the current hostname of a server and then set it into a configuration file. I cannot figure it out how can I push the shell output using the lineinfile module. - name: Get hostname shell: echo…
pedrocalixto
  • 53
  • 1
  • 1
  • 3
5
votes
1 answer

Why do some r10k configuration files start their YAML lines with :?

I'm looking at setting up r10k for Puppet deployment, and I have various example r10k.yaml configuration files, but some seem to use an extra : at the start of many lines, for instance, at http://www.rubydoc.info/gems/r10k/1.1.4: --- :cachedir:…
Iain Hallam
  • 447
  • 2
  • 6
  • 21
4
votes
1 answer

Adding an existing security group CloudFormation EC2 template

Instead of having to set ingress and egress rules, how do I reference existing EC2 security groups in a CloudFormation Template? Resources: EC2Instance: Type: AWS::EC2::Instance Properties: InstanceType: …
4
votes
1 answer

Verifying Salt states before committing

I'm storing my salt sls files in a git repository, but I have the perennial problem that I can't verify my YAML represents a valid set of states that could be applied (I've also had difficulty validating my YAML -- that's much easier, though). …
Andrew Aylett
  • 599
  • 3
  • 14
3
votes
1 answer

Problems with setting up bonding on Netplan (Ubuntu server 18.04)

I have a dual port network card that I want to bond both ports and balance the traffic between ports. I want 1 static IP address. I used to ubuntu 16.04 and this worked fine. Im now trying to set up the same thing in netplan and am struggling. …
3
votes
2 answers

How does the formatting policy look like since Ansible 2.0?

I have seen multiple Ansible examples on github and in the ansible docs, e.g.: --- # this might be in a file like handlers/handlers.yml - name: restart apache service: name=apache state=restarted Github example The following example contains both…
030
  • 5,731
  • 12
  • 61
  • 107
3
votes
1 answer

dict as value for YAML key in an Ansible task

I am unable to figure out how to pass a dictionary/hash-map of key-value pairs as the value for an option in an ansible tasks. Default Options: # roles/ec2/defaults/main.yml ec2: key_name: "{{ key_name }}" instance_type: m3.medium image:…
Mark Feltner
  • 131
  • 1
  • 3
3
votes
1 answer

How to define multiple /etc/hosts entries with Puppet ENC?

I'm writing an External Node Classifier for my Puppet infrastructure, and I have the need to manipulate the /etc/hosts file on each node. The following (due to the duplicate key) is invalid YAML: --- host: name: www1.example.com …
Chris Tonkinson
  • 465
  • 2
  • 6
  • 18
3
votes
1 answer

Cross-reference Ansible variables within the same mapping

How can I define an Ansible variable whose value is another variable in the same mapping structure? To allow sensible namespacing of variables, I am defining mapping structures like this, where some values depend on other variables in the same…
bignose
  • 942
  • 10
  • 20
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
  • 193
  • 1
  • 2
  • 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
  • 351
  • 1
  • 2
  • 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
  • 501
  • 3
  • 10
  • 23
1
2 3 4 5 6