On Fri, Apr 23, 2021 at 12:24 PM rebecca acheampong <
bec1...@gmail.com> wrote:
>
> Thank you. Trying the options. I have sat on it the whole day, i feel exhausted with it.
> Thank you. I will get back whatever results i have
>
Some suggestions, assuming the name of the host you want to run
ansible on is 'cyber01' and going from simpler to more sophisticated:
1. Test by passing the username and asking for the password from the
command line. In this example I am just running the 'whoami' command:
ansible cyber01 --extra-vars 'ansible_user=user' --ask-pass -a whoami
2. Do not have passwords defined in your inventory. If you need a
password, ask for them as shown above.
3. Instead of password, consider a SSH keypair. This way you can have
something like this in your inventory
192.168.154.163 ansible_ssh_private_key_file="~/.ssh/cyber01" ansible_user=user
Note it is looking for the private key at my user's default location;
where you place it depends on your needs.
4. Consider having a host_vars/cyber01.yml file instead of cluttering
the inventory one. You can then populate this file with all the
initial constants you need (IP address, username, etc), passing any
variables that might change at runtime using --extra_vars as shown
above.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAKQAy6qXt-HBEJFO-o3HAzbcKkXrueQBNFzcgXs5k1-dT%3DYC6g%40mail.gmail.com.