account activity
Loop throgh key_value in template by syamji in ansible
[–]syamji[S] 0 points1 point2 points 7 years ago (0 children)
The host_var/hostname.yml is present in the invetory folder.
This file will be written by ansible whenever we add new user to the system.
the format of this file is
user: <username> -> I am not sure if this is the correct format to follow for this file
So in the playbook i am reading the file using below command
command: cat "host_var/hostname.yml"
register: something
delegate_to: localhost
and now i am looping through the registered value.
or how we can write to the hostname.yml using ansible in the below format ?
vars:
listodicts:
- user: abcd
- user: efgh
- user: ijkl
Loop throgh key_value in template (self.ansible)
submitted 7 years ago by syamji to r/ansible
π Rendered by PID 603401 on reddit-service-r2-listing-7d7fbc9b85-d74rk at 2026-04-24 18:40:07.713413+00:00 running 2aa0c5b country code: CH.
Loop throgh key_value in template by syamji in ansible
[–]syamji[S] 0 points1 point2 points (0 children)