Last active
January 20, 2021 00:15
-
-
Save 0xSheepdog/4d6cd532d3310210a1ffc32401853a3f to your computer and use it in GitHub Desktop.
A simple, quick ansible.cfg example file. AND a not quite so simple YAML formatted inventory/hosts file. Examples for multiple group membership, host and group variables ... please review the official doco.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[defaults] | |
inventory = ./inventory.yml | |
vault_password_file = .vaultpass | |
retry_files_enabled = false | |
roles_path = ./roles | |
gathering = smart | |
callback_whitelist = timer, profile_tasks | |
[privilege_escalation] | |
become = true | |
become_method = sudo | |
become_user = root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
hosts: | |
jump-server.example.com: | |
ansible_port: 5555 | |
ansible_host: 192.0.2.50 | |
children: | |
webservers: | |
hosts: | |
http-foo.example.com: | |
http2-foo.example.com: | |
nginx[1:4].example.com: | |
dbservers: | |
hosts: | |
mariasql.example.com: | |
pgsql1.example.com: | |
pgsql2.example.com: | |
mysql[1:5].example.com: | |
production: | |
hosts: | |
http-foo.example.com: | |
nginx1.example.com: | |
nginx2.example.com: | |
pgsql1.example.com: | |
mysql[1:2].example.com: | |
vars: | |
remote_user: productionpush | |
test: | |
hosts: | |
http2-foo.example.com: | |
nginx[3:4].example.com: | |
pgsql2.example.com: | |
mysql[3:4].example.com: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please review the inventory.yml carefully if you are using this. Ref: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#host-variables
Output from my
ansible-inventory --list -i inventory.yml