Hello, I’m new to Ansible: Here’s what I’m looking to do for my first playbook/automation with it.
I have a list of users, like below. Oh and by the way I’m running this on OSX. First of all where do I save this file? and what to a call it? anythingiwant.yaml?
List of uses
abc123
def532
gth593
Second I have my hosts file setup with my computers and was able to have anible successfully connect to each of them.
Now how do I take my list of users and have ansible create user accounts plus add their public keys which i have saved on my system to the hosts in my file?
I was able to manually run the addusers module but I could only get it to accept the first user value it kept failing if I also tied to give it a comment. I also don’t want to have to do the manual process for each user plus another manual process to add their keys.
Hello, I'm new to Ansible: Here's what I'm looking to do for my first
playbook/automation with it.
I have a list of users, like below. Oh and by the way I'm running this on
OSX. First of all where do I save this file? and what to a call it?
anythingiwant.yaml?
# List of uses
- abc123
- def532
- gth593
Variables need names:
list_of_users:
- abc123
- def532
etc
Second I have my hosts file setup with my computers and was able to have
anible successfully connect to each of them.
Now how do I take my list of users and have ansible create user accounts
plus add their public keys which i have saved on my system to the hosts in
my file?
Read up on the user module and this will be a good start.
I was able to manually run the addusers module but I could only get it to
accept the first user value it kept failing if I also tied to give it a
comment. I also don't want to have to do the manual process for each user
plus another manual process to add their keys.
If you are experiencing a problem, it's helpful to see what you tried and
the output.