Limit to specific hosts

Run the playbook only on web01 and web02

ansible-playbook deploy.yml -i inventory.ini --limit 'web01,web02'

tool
ansible56 commands
tags
ansible

More ansible commands

  • ansible-playbook site.yml -i inventory.ini --step

    Confirm each task before it runs; useful for debugging

  • ansible-vault rekey vault.yml --new-vault-password-file new_pass.txt

    Re-encrypt a vault file with a new password without exposing the plaintext; a safe way to rotate the vault password

  • ansible-playbook site.yml --vault-id dev@dev_pass.txt --vault-id prod@prompt

    Mix vault IDs: a password file for dev and a prompt for prod, so each environment has its own secrets

  • EDITOR=vim ansible-vault edit group_vars/prod/secrets.yml --vault-password-file ~/.vault_pass

    Decrypt, edit in $EDITOR and encrypt again in one step; the decrypted temp file is removed when you close the editor

  • ansible-inventory -i aws_ec2.yml --graph --vars

    Show the cloud inventory tree with host vars; check the plugin grouping before a run

all 56 ansible commands