Created
January 11, 2016 17:34
-
-
Save agile/4bc0ea5d244998a33376 to your computer and use it in GitHub Desktop.
This file contains 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
[appservers:children] | |
datacenter-1 | |
datacenter-2 | |
[datacenter-1] | |
appservers00[1:3].datacenter-1.example.com | |
[datacenter-2] | |
appservers00[1:3].datacenter-2.example.com | |
# or, should I group the servers how I want them updated instead? | |
[group1] | |
appservers001.datacenter-1.example.com | |
appservers001.datacenter-2.example.com | |
[group2] | |
appservers002.datacenter-1.example.com | |
appservers002.datacenter-2.example.com | |
[group3] | |
appservers003.datacenter-1.example.com | |
appservers003.datacenter-2.example.com |
This file contains 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
- hosts: appservers | |
serial: 2 |
This file contains 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
$ ansible-playbook -i inventory.ini --list-hosts playbook.yml | |
playbook: playbook.yml | |
play #1 (appservers): host count=6 | |
appservers001.datacenter-1.example.com | |
appservers002.datacenter-1.example.com | |
appservers003.datacenter-1.example.com | |
appservers001.datacenter-2.example.com | |
appservers002.datacenter-2.example.com | |
appservers003.datacenter-2.example.com | |
# which is going to update the hosts serially through that list? | |
# I want them to be updated in groups by their hostnames: 001, 002, 003, etc.. | |
# I can achieve this by successively calling the playbook with a limit: | |
$ ansible-playbook -i inventory.ini --list-hosts --limit *001* playbook.yml | |
playbook: playbook.yml | |
play #1 (appservers): host count=2 | |
appservers001.datacenter-1.example.com | |
appservers001.datacenter-2.example.com | |
# is there another way to organize the inventory, to make it work like this by default? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment