Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevinburke/ansible-go
https://github.com/kevinburke/ansible-go
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kevinburke/ansible-go
- Owner: kevinburke
- Created: 2016-11-26T23:25:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-13T17:05:44.000Z (almost 8 years ago)
- Last Synced: 2024-05-01T23:57:44.877Z (7 months ago)
- Language: Go
- Size: 41 KB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ansible-go
Attempting to reproduce Ansible's APIs with a programming language (instead of
YAML), so you have more flexibility about how things get called.Right now supports running commands on a single host at a time. The only
supported protocol is SSH'ing to a remote host and running some commands
(instead of, say, running mysql from your local machine to a remote host).For the moment we are targeting Ubuntu Linux. If we want to support other
platforms, probably the way to implement this will be to copy the subclassing
relationship in Ansible, documented e.g. here:```python
A subclass may wish to override the following action methods:-
- create_user()
- remove_user()
- modify_user()
- ssh_key_gen()
- ssh_key_fingerprint()
- user_exists()All subclasses MUST define platform and distribution (which may be None).
```But use interfaces for those as well, so:
```go
type UserImpl interface {
Add(context.Context, ssh.Host, string, UserOpts)
Remove(context.Context, ssh.Host, string)
Modify(context.Context, ssh.Host, string, UserOpts)
Exists(context.Context, ssh.Host, string) bool
SSHKeyGen(context.Context, ssh.Host, string, SSHKeyGenOpts)
}
```where `core.AddUser` switches the impl based on the `host.Platform`.