Last active
May 5, 2022 15:32
-
-
Save theodorosploumis/49372ce118591096a6ee to your computer and use it in GitHub Desktop.
Simple Ansible ad-hoc commands for Shared Hosting
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
// Inventory name is "hosts" | |
// Example of inventory | |
[group] | |
SERVER_NAME ansible_connection=ssh ansible_ssh_user=SSH_USER ansible_python_interpreter=PATH_TO_REMOTE | |
_PYTHON | |
// List hosts | |
ansible -i hosts all --list-hosts | |
// Show info for each host | |
ansible -i hosts all -m setup | |
// Ping all hosts (module ping) | |
ansible all -i hosts -m ping | |
// Run `pwd` on shell | |
ansible all -i hosts -m shell -a "pwd" | |
// Use drush | |
ansible all -i hosts -m shell -a "cd test.com/www; ~/drush/drush dl drupal" | |
ansible all -i hosts -m shell -a "cd test.com/www; ~/drush/drush up drupal" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment