{"id":29647322,"url":"https://github.com/nahsi/ansible-consul","last_synced_at":"2026-03-15T03:33:41.612Z","repository":{"id":37039854,"uuid":"427491165","full_name":"nahsi/ansible-consul","owner":"nahsi","description":"Ansible role for HashiCorp Consul","archived":false,"fork":false,"pushed_at":"2025-06-18T16:30:22.000Z","size":55,"stargazers_count":1,"open_issues_count":12,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-22T01:58:11.944Z","etag":null,"topics":["ansible","consul","gentoo","hashicorp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nahsi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-12T20:42:10.000Z","updated_at":"2023-08-28T12:21:34.000Z","dependencies_parsed_at":"2023-12-05T12:31:42.455Z","dependency_job_id":"84a838d8-85a6-4c53-8ad0-8f98f398fc5a","html_url":"https://github.com/nahsi/ansible-consul","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nahsi/ansible-consul","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahsi%2Fansible-consul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahsi%2Fansible-consul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahsi%2Fansible-consul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahsi%2Fansible-consul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nahsi","download_url":"https://codeload.github.com/nahsi/ansible-consul/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahsi%2Fansible-consul/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266417269,"owners_count":23925301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","consul","gentoo","hashicorp"],"created_at":"2025-07-22T03:07:35.661Z","updated_at":"2026-03-15T03:33:41.569Z","avatar_url":"https://github.com/nahsi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Consul\n\nInstall, configure and maintain [Consul](https://www.consul.io) - a service mesh\nfrom HashiCorp.\n\n## Role Philosophy\n\nInstead of duplicating every single configuration option as an Ansible variable Consul\nconfiguration is stored in Ansible inventory in `yaml` format:\n\n```yml\nconsul_config:\n  data_dir: \"/var/lib/consul/\"\n\n  enable_syslog: true\n  # \"trace\", \"debug\", \"info\", \"warn\", \"err\"\n  log_level: \"info\"\n  syslog_facility: \"LOCAL5\"\n\n  rejoin_after_leave: true\n\n  bind_addr: !unsafe '{{ GetInterfaceIP \"eth0\" }}'\n\n  telemetry:\n    disable_hostname: true\n    prometheus_retention_time: \"30s\"\n\n  server: false\n```\n\nAnd then copied to host using `no_nice_json` filter:\n\n```yml\n- name: copy consul config\n  copy:\n    content: \"{{ consul_config | to_nice_json }}\"\n    dest: \"/opt/consul/consul.json\"\n    validate: \"consul validate -config-format=json %s\"\n```\n\nWhen variable is a map (`consul_services` for example) every key of a map will\nbe copied as file with value as a content.\n\nThe following map\n\n```yml\nconsul_services:\n  consul:\n    service:\n      id: \"consul-api\"\n      name: \"consul-api\"\n      port: 8500\n      tags:\n        - \"traefik.enable=true\"\n        - \"traefik.http.routers.consul.entrypoints=https\"\n        - \"traefik.http.routers.consul.rule=Host(`consul.example.com`)\"\n      meta:\n        external-source: \"consul\"\n      check:\n        id: \"consul-api-health\"\n        name: \"consul-api-health\"\n        http: \"http://localhost:8500/v1/agent/self\"\n        interval: \"20s\"\n        timeout: \"2s\"\n\n  telegraf:\n    service:\n      id: \"telegraf-exporter\"\n      name: \"telegraf-exporter\"\n      port: 9271\n      meta:\n        external-source: \"consul\"\n      check:\n        id: \"telegraf-exporter-health\"\n        name: \"telegraf-exporter-health\"\n        http: \"http://localhost:9270\"\n        interval: \"20s\"\n        timeout: \"2s\"\n```\n\nwill produce files `consul.json` and `telegraf.json` in\n`/opt/consul/service.d/`.\n\nFiles that are not present in the map will be deleted, thus allowing to maintain\na state with Ansible inventory.\n\n## Role Variables\n\nSee [defaults/](https://github.com/nahsi/ansible-consul/blob/master/defaults/)\nfor details and examples.\n\n#### `consul_version`\n\n- version to use\n\n#### `consul_dirs`\n\n- a map of directories to create\n- default:\n\n```yml\nconsul_dir: \"/opt/consul\"\nconsul_dirs:\n  main:\n    path: \"{{ consul_dir }}\"\n  configs:\n    path: \"{{ consul_dir }}/config.d\"\n  services:\n    path: \"{{ consul_dir }}/service.d\"\n  certs:\n    path: \"{{ consul_dir }}/certs\"\n    mode: \"u=rwX,g=rX,o=\"\n  scripts:\n    path: \"{{ consul_dir }}/script.d\"\n  logs:\n    path: \"/var/log/consul\"\n  data:\n    path: \"/var/lib/consul\"\n    mode: \"u=rwX,g=rX,o=\"\n```\n\n#### `consul_config`\n\n- main [configuration](https://www.consul.io/docs/agent/options) file\n- example: please see\n  [defaults/example.yml](https://github.com/nahsi/ansible-consul/blob/master/defaults/example.yml)\n\n#### `consul_configs`\n\n- map of configuration files to create in `config.d` directory. Restart on\n  changes\n\n#### `consul_services`\n\n- map of [service](https://www.consul.io/docs/discovery/services) files to\n  create in `service.d` directory. Reload on changes\n\n#### `consul_scripts`\n\n- map of scripts to create in `scripts.d` directory\n\n#### `consul_user`\n\n- owner of Consul process and files\n- default: `consul`\n\n#### `consul_group`\n\n- group of `consul_user`\n- default: `consul`\n\n#### `consul_download_url`\n\n- url to get Consul archive from\n- default: `https://releases.hashicorp.com`\n\n#### `consul_service`\n\n- openrc service file\n- default: see\n  [defaults/main.yml](https://github.com/nahsi/ansible-consul/blob/master/defaults/main.yml)\n\n#### `consul_unitfile`\n\n- systemd unit file\n- default: see\n  [defaults/main.yml](https://github.com/nahsi/ansible-consul/blob/master/defaults/main.yml)\n\n#### `skip_handlers`\n\n- skipt consul restart/reload - useful when building images with packer\n- default: `false`\n\n## Tags\n\n- `config` - update Consul unit/service file and sync configuration files\n- `services` - sync Consul services\n- `scripts` - sync Consul scripts\n\n## Author\n\n- **Anatoly Laskaris** - [nahsi](https://github.com/nahsi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnahsi%2Fansible-consul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnahsi%2Fansible-consul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnahsi%2Fansible-consul/lists"}