Sunday, January 1, 2023

Setting up my MAC as a Control node for my Ansible study - Part 1

 Here is my requirement, I am using my MAC so i need to develop Ansible playbooks in my MAC book.

I used PIP to install ansible in my mac book. After installation i am not able to do any ansible commands and I fixed the issue using this link (https://www.linuxblackmagic.com/2023/01/after-install-ansible-using-pip-in-mac.html)

After this, when you try to add hosts or ansible.cfg file, you may not find this in your mac.

I checked $HOME/.ansible folder and i can't find it.

I downloaded a sample configuration of ansible.cfg to the $HOME/.ansible folder

Then i created a hosts file which is defined in the inventory section of the ansible.cfg file.

localhost              ansible_connection=local

Then I tried a test using this command.

 ansible -i $HOME/.ansible/hosts -m ping all

localhost | SUCCESS => {

    "ansible_facts": {

        "discovered_interpreter_python": "/opt/homebrew/bin/python3.11"

    },

    "changed": false,

    "ping": "pong"

} 

No comments:

Post a Comment