Skip to content

Instantly share code, notes, and snippets.

@sfloess
Last active September 29, 2022 21:00
Show Gist options
  • Save sfloess/d336c2adccbfad0ec370e3d96ee099ff to your computer and use it in GitHub Desktop.
Save sfloess/d336c2adccbfad0ec370e3d96ee099ff to your computer and use it in GitHub Desktop.
Ansible

Ansible

Ansible tips and tricks

How To

Run Playbook in Parallel

To run a playbook in parallel, include the following: strategy: free

Example:

---

- name: Setup redhat-test-0[1-4] VMs 
  strategy: free
  hosts: redhat-test-01,redhat-test-02,redhat-test-03,redhat-test-04

  roles:
  - redhat/host/redhat-test/fedora

Use .pem file

How To. Inventory file:

[something:vars]
ansible_ssh_private_key_file=/home/sfloess/.ssh/mykeypair.pem

[something]
1.2.3.4

Encryption

  • Environment var DEFAULT_VAULT_PASSWORD_FILE: file containing password when encrypting.
  • Encrypt a variable: ansible-vault encrypt_string --vault-password-file [password file] '[to encrypt]' --name 'key'
    • ansible-vault encrypt_string --vault-password-file ~/passwords/myVault 'mypassword' --name 'db_password'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment