Setup your development environment based on Ansible routines for software provisioning, configuration management, and application-deployment as infrastructure as code, tested with molecule.
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.curl
which is required to install pyenv
sudo apt install openssh-server curl
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
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
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 \
build-essential \
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 .
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
-
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
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
Details at DEVELOPMENT.md