project structure (ansible best practice).
project/
group_vars/
development
inventory.development
playbook.yaml
it all starts with inventory.development
[development]
dev.fakename.io
[development:vars]
ansible_host: 192.168.0.1
ansible_user: dev
ansible_pass: pass
ansible_port: 2232
[api:children]
development
which lets you link to group_vars. Hold data 'specific' to that environment ...
---
app_name: NewApp_Dev
app_url: https://dev.fakename.io
app_key: f2390f23f01233f23f
that lets one run the following playbook AGAINST the inventory file:
---
- name: Install api.
hosts: api
gather_facts: true
sudo: true
tags:
- api
roles:
- { role: api, tags: ["api"] }
with the following runline:
ansible-playbook playbook.yaml -i inventory.development