{"id":21207005,"url":"https://github.com/paralect/ansible-profiles-plugin","last_synced_at":"2026-01-01T22:05:56.002Z","repository":{"id":12216128,"uuid":"14823426","full_name":"paralect/ansible-profiles-plugin","owner":"paralect","description":"Profiles management plugin for Ansible","archived":false,"fork":false,"pushed_at":"2013-12-01T21:01:48.000Z","size":148,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-21T15:49:23.571Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paralect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-30T15:30:56.000Z","updated_at":"2016-02-17T00:09:22.000Z","dependencies_parsed_at":"2022-09-14T15:40:44.940Z","dependency_job_id":null,"html_url":"https://github.com/paralect/ansible-profiles-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralect%2Fansible-profiles-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralect%2Fansible-profiles-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralect%2Fansible-profiles-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralect%2Fansible-profiles-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paralect","download_url":"https://codeload.github.com/paralect/ansible-profiles-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658821,"owners_count":20326570,"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","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":[],"created_at":"2024-11-20T20:57:27.481Z","updated_at":"2026-01-01T22:05:55.917Z","avatar_url":"https://github.com/paralect.png","language":"Python","readme":"# Ansible Profiles Plugin\n\nProfiles management plugin for Ansible.\n\n## About\n\nAnsible uses two folders to manage variables: `host_vars` and `group_vars`. This plugin uses additional folder, `profiles`, which may consists of unlimited hierarchy of folders to represent profiles. There is only one file inside each profile directory: `vars.yml`. Child profiles always overwrite variables from parent profile. We will show how it works soon.\n\nHere is a possible structure of `profiles` folder:\n\n```\n[profiles]\n   [production]\n      [datacenter1]\n         vars.yml\n      [datacenter2]\n         vars.yml\n      vars.yml\n   [stage]\n      vars.yml\n   [qa]\n      vars.yml\n   [local]\n      [john]\n         vars.yml\n      [tom]\n         vars.yml\n      [brett]\n         vars.yml\n      vars.yml\n   ...\n   vars.yml\n```\n\nIt defines several profiles, for instance:\n\n1. `production`\n2. `production/datacenter1`\n3. `local`\n4. `local/john`\n5. _root_ profile (represented by empty string: `\"\"`)\n6. ...\n\n## Turn on profile\n\nThere are two ways to select profile. \n\nCreate `.profile` file in the same folder, where your `profiles` folder is located with the \nfollowing content:\n\n```\nprofile: production/datacenter1\n```\n\nThis file should be marked as ignored for your SCM tool (git, svn etc.).\n\nOr set environment variable `ANSIBLE_PROFILE`:\n\n```\nexports ANSIBLE_PROFILE=production/datacenter1\n```\n\nIf you have specified `ANSIBLE_PROFILE` environment variable, then `.profile` file will be ignored.\n\n\n## Example\n\nIf `profiles/vars.yaml` has the following configuration:\n\n```\ndb_port: 4000\nhost: roothost.com\nauthor: StarCompany\n```\n\nAnd `profiles/local/vars.yml` has the following configuration:\n\n```\ndb_port: 5000\nhost: localhost\n```\n\nAnd finally `profiles/local/john/vars.yml` has the following configuration:\n\n```\ndb_port: 6000\nhost: johnhost.org\n```\n\nThen, _root_ profile will have the following state (it is completely equal \nto the content of `profiles/vars.yml`):\n\n```\ndb_port: 4000\nhost: roothost.com\nauthor: StarCompany\n```\n\nProfile `local` will be:\n\n```\ndb_port: 5000\nhost: localhost\nauthor: StarCompany\n```\n\nProfile `local/john` will be:\n\n```\ndb_port: 6000\nhost: johnhost.org\nauthor: StarCompany\n```\n\n## Installation\n\nCopy `profiles.py` file to `vars_plugins` folder near your root playbooks:\n\n```\n[group_vars]\n[host_vars]\n[profiles]\n[vars_plugins]\n   profiles.py      \u003c-- here is a Profiles Plugin\nhosts\nplaybook.yml\n```\n\nTurn on profile by either creating `.profile` file near your root playbooks with \nthe following content:\n\n    profile: relative/path/to/your/profile\n    \nor set `ANSIBLE_PROFILE` environment profile:\n\n    exports ANSIBLE_PROFILE=relative/path/to/your/profile\n   \n#### Global install \n\nYou also can install this plugin globally, by coping `profiles.py` to the ansible `vars_plugins` folder. In order to find the path to `vars_plugins` folder refer to `ansible.cfg` (location of this file is specific to your distribution, on Ubuntu it is located in `/etc/ansible/ansible.cfg` and/or `~/.ansible.cfg`\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparalect%2Fansible-profiles-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparalect%2Fansible-profiles-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparalect%2Fansible-profiles-plugin/lists"}