apenella / go-ansible

Go-ansible is a Go package that enables the execution of ansible-playbook or ansible commands directly from Golang applications. It supports a wide range of options for each command, enabling smooth integration of Ansible functionality into your projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to connection other nodes?

XuHaoIgeneral opened this issue · comments

commented

ansiblePlaybookConnectionOptions := &ansibler.AnsiblePlaybookConnectionOptions{
Connection: "local",
}

when i chnage Connection: local to Connection:<my node ip>

ansiblePlaybookConnectionOptions := &ansibler.AnsiblePlaybookConnectionOptions{
Connection: "192.168.1.176",
}

Additional context:

Go-ansible example => fatal: [192.168.1.176]: FAILED! => {"msg": "the connection plugin '192.168.1.176' was not found"}
Go-ansible example => to retry, use: --limit @/root/go/src/github.com/apenella/go-ansible/examples/simple-ansibleplaybook/site.retry
Go-ansible example =>
Go-ansible example => PLAY RECAP

Hi, @XuHaoIgeneral
In that case you would skip Connection definition. You should define your node on ansible's inventory and set the playbook hosts to use that node.

commented

n. You should define your node on ansible's inventory and set the playbook hosts to use that node.

thanks.