Skip to content

Setup your development environment based on Ansible routines for software provisioning, configuration management, and application-deployment as infrastructure as code, tested with molecule.

License

Notifications You must be signed in to change notification settings

cmuck/config-files

Repository files navigation

config-files

CI

Setup your development environment based on Ansible routines for software provisioning, configuration management, and application-deployment as infrastructure as code, tested with molecule.

Installation

Setup SSH for Ansible

Ansible is used to configure the system and requires a SSH connection.

First, ensure to have an up-to-date system

sudo apt update && sudo apt dist-upgrade

A vanilla Ubuntu installation missing openssh-server which is required by Ansible.

sudo apt install openssh-server

Check if openssh-server is running

systemctl status ssh

Please re-use your existing SSH key if already created or create a new SSH key

Setup Python and runtime dependencies

The script execution is based on Python 3.12 and a virtual environment, so continue to install these dependencies.

To install Python 3.12 on older systems like Ubuntu 20.04 LTS or 22.04 LTS pyenv is used which is a simple Python version management.

curl https://pyenv.run | bash

If curl is missing on your system, please install by

sudo apt-get install curl

Install Python 3.12 using pyenv by

pyenv install 3.12

If the Python build fails, install required dependencies by

sudo apt-get install --no-install-recommends \
  curl \
  libssl-dev \
  ncurses-dev \
  libffi-dev \
  libreadline-dev \
  sqlite3 libsqlite3-dev \
  tk-dev \
  bzip2 libbz2-dev \
  lzma liblzma-dev

Create the virtual environment and activate it

pyenv virtualenv 3.12 py312cf
pyenv activate py312cf

Now you're ready to install runtime dependencies using pip-tools

pip install pip-tools
# Install Python runtime dependencies, see requirements.txt
pip-sync

Finally, install the script config-files to the local virtual environment

pip install -e .

Usage

When installed to the local virtual environment, you can use the script by the command cf

cf -h
usage: config-files [-h] [-t TAG [TAG ...]] [-v] [-d] [-c] playbook

positional arguments:
  playbook              Playbook from playbooks directory, e.g. "helloworld"

optional arguments:
  -h, --help            show this help message and exit
  -t TAG [TAG ...], --tag TAG [TAG ...]
                        Only tag from playbook is executed, e.g. --tag zsh git
  -v, --verbose         Increase verbosity of ansible to level 1
  -d, --dry-run         Execution with --check option
  -c, --check           Executes only a syntax-check of the playbook

Examples

  • Default usage

    cf developer
  • Syntax-check of the playbook

    cf -c developer
  • Dry-run of the playbook

    cf -d developer
  • Execute specific tags of the playbook

    cf -t zsh git developer
  • Increase verbosity

    cf -v developer

Playbook helloworld

Can be used to check e.g. if config-files and Ansible works properly

cf helloworld
cf -v helloworld
cf -d helloworld
cf -c helloworld

Development

Details at DEVELOPMENT.md

Links

About

Setup your development environment based on Ansible routines for software provisioning, configuration management, and application-deployment as infrastructure as code, tested with molecule.

Topics

Resources

License

Stars

Watchers

Forks