Skip to content

imShakil/automation-with-ansible

Repository files navigation

Automation With Ansible

Workstation setup for Ansible development with VS Code integration.

Environment

  • OS: macOS 14.x (Sonoma)
  • Python: 3.11+ (installed via Homebrew)
  • Ansible: 12.1.0 with core 2.19.3 (pip install)

VS Code Extensions

  • Ansible: Red Hat Ansible extension for syntax highlighting and IntelliSense
  • YAML: YAML language support with validation
  • Python: Python language support
  • GitLens: Enhanced Git capabilities
  • EditorConfig: Consistent coding styles

SSH Configuration

  • SSH keys stored in ~/.ssh/
  • Config file: ~/.ssh/config
  • Add your public keys to target hosts
  • Never commit private keys to repository

Git Configuration

git config --global user.name "Your Name"
git config --global user.email "your.email@company.com"
# Optional: GPG signing
git config --global user.signingkey <GPG_KEY_ID>
git config --global commit.gpgsign true

Checkout this medium blog to setup signed commit

Virtual Environment

# Create and activate venv
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run linting
ansible-lint playbooks/
yamllint .

Corporate Environment

  • Set proxy: export https_proxy=http://proxy.company.com:8080
  • CA certificates: Add to ~/.ansible/ca-bundle.crt
  • Update pip config for internal PyPI if needed

New Machine? Do This

  • Install Homebrew and Python 3.11+
  • Clone this repository
  • Create and activate Python virtual environment
  • Install requirements: pip install -r requirements.txt
  • Install pre-commit hooks: pre-commit install
  • Configure Git user name and email
  • Generate SSH key pair and add to ssh-agent
  • Install VS Code and required extensions
  • Test Ansible connection to target hosts
  • Run ansible-lint and yamllint to verify setup
  • Create inventories directory and add your hosts
  • Configure corporate proxy/CA certificates if needed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Contributors