Al West:
Sorry I don’t have access to my lab at the moment to try this out for you.
Diana:
It’s ok i can check if it works my self
Diana:
This is what i have configured yesterday because i thought this is what should be done
Al West:
that isn’t yaml
Al West:
try ansible_user: ubuntu
Diana:
Do i need to configure anything else in those files?
Al West:
if the ssh key used for both then should be fine
Al West:
you should be able to do ansible -m ping all -i inventory.yaml
Al West:
Though I am not sure if the file in the group_vars folder should be named like tag_Name_ubuntu.yaml
Diana:
So i don’t need to specify an inventory file?
Diana:
It worked when i run it like that: ansible-playbook -C docker.yml
Diana:
cat docker.yml
---
# docker.yml
- name: Use a galaxy role to install docker
hosts: "all"
become: true
roles:
- role: "geerlingguy.docker"
tags: ["docker"]
Al West:
Can you first verify ansible -m ping all -i inventory_aws_ec2.yml
works first
Diana:
Actually i ran it with an inventory file and it works as well
Al West:
okay good
Diana:
ansible -m ping all -i inventory_aws_ec2.yml
<http://ec2-34-228-240-228.compute-1.amazonaws.com|ec2-34-228-240-228.compute-1.amazonaws.com> | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
<http://ec2-34-229-176-63.compute-1.amazonaws.com|ec2-34-229-176-63.compute-1.amazonaws.com> | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
<http://ec2-54-198-26-83.compute-1.amazonaws.com|ec2-54-198-26-83.compute-1.amazonaws.com> | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
Al West:
nice one
Diana:
So let me understand that, i have to create the group_vars folder in order it to work?
Diana:
How does it know what user to use?
I didn’t specify the files in the group_vars folder…