Skip to content

williamchanrico/ansible-inv-to-consul-svc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Inventory To Consul Service Entries

Convert Ansible static inventory

[hostgroup1]
1.1.1.1 consul_tag=abc

[hostgroup2]
2.2.2.2

into YAML format understood by this consul ansible role:

consul_services:
- name: hostgroup1
  address: "1.1.1.1"
  tags:
  - abc
- name: hostgroup2
  address: "2.2.2.2"

Example

$ go run main.go ./example.ini    
consul_services:
- address: 10.255.1.11
  name: mysql-slave
- address: 10.255.1.10
  name: mysql-slave
- address: 10.255.1.5
  name: docker-registry
- address: 10.255.1.2
  name: order
  tags:
  - internal

Credits

https://github.com/outten45/aini

Small customization to support custom consul_tag ansible variable.

About

Simple converter for ansible static inventory.ini to YAML

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages