From b5394b34ca0ddbfca368fdd8ae562457d773e040 Mon Sep 17 00:00:00 2001 From: lauralani Date: Thu, 4 Apr 2024 08:17:30 +0200 Subject: [PATCH] initial commit --- .gitignore | 160 ++++++++++++++++++++++++ Makefile | 18 +++ development.yaml | 3 + playbook_changeme.yml | 4 + production.yaml | 3 + readme.md | 50 ++++++++ requirements.in | 2 + requirements.txt | 53 ++++++++ roles/role_change_me/files/.gitkeep | 0 roles/role_change_me/tasks/main.yml | 1 + roles/role_change_me/templates/.gitkeep | 0 roles/role_change_me/vars/main.yml | 1 + 12 files changed, 295 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 development.yaml create mode 100644 playbook_changeme.yml create mode 100644 production.yaml create mode 100644 readme.md create mode 100644 requirements.in create mode 100644 requirements.txt create mode 100644 roles/role_change_me/files/.gitkeep create mode 100644 roles/role_change_me/tasks/main.yml create mode 100644 roles/role_change_me/templates/.gitkeep create mode 100644 roles/role_change_me/vars/main.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6769e21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c8460b5 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +.PHONY: all venv clean + +ALL_TARGETS := venv + +PYTHON_BIN?=python3 + +all: $(ALL_TARGETS) + +venv: venv/bin/activate + +venv/bin/activate: requirements.txt + test -d venv || $(PYTHON_BIN) -m venv venv + . venv/bin/activate; pip install --upgrade pip wheel + . venv/bin/activate; pip install -r requirements.txt + touch venv/bin/activate + +clean: + test -d venv && rm -rf venv || exit 0 \ No newline at end of file diff --git a/development.yaml b/development.yaml new file mode 100644 index 0000000..b4cd004 --- /dev/null +++ b/development.yaml @@ -0,0 +1,3 @@ +role_change_me: + hosts: + change_me: \ No newline at end of file diff --git a/playbook_changeme.yml b/playbook_changeme.yml new file mode 100644 index 0000000..5773b74 --- /dev/null +++ b/playbook_changeme.yml @@ -0,0 +1,4 @@ +- hosts: group_changeme + gather_facts: no + roles: + - role_change_me \ No newline at end of file diff --git a/production.yaml b/production.yaml new file mode 100644 index 0000000..b4cd004 --- /dev/null +++ b/production.yaml @@ -0,0 +1,3 @@ +role_change_me: + hosts: + change_me: \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..a13904d --- /dev/null +++ b/readme.md @@ -0,0 +1,50 @@ +# ansible-template +## Project Layout +``` +production # inventory file for production servers +staging # inventory file for staging environment + +group_vars/ + group1.yml # here we assign variables to particular groups + group2.yml +host_vars/ + hostname1.yml # here we assign variables to particular systems + hostname2.yml + +library/ # if any custom modules, put them here (optional) +module_utils/ # if any custom module_utils to support modules, put them here (optional) +filter_plugins/ # if any custom filter plugins, put them here (optional) + +site.yml # main playbook +webservers.yml # playbook for webserver tier +dbservers.yml # playbook for dbserver tier +tasks/ # task files included from playbooks + webservers-extra.yml # <-- avoids confusing playbook with task files +``` + +``` +roles/ + common/ # this hierarchy represents a "role" + tasks/ # + main.yml # <-- tasks file can include smaller files if warranted + handlers/ # + main.yml # <-- handlers file + templates/ # <-- files for use with the template resource + ntp.conf.j2 # <------- templates end in .j2 + files/ # + bar.txt # <-- files for use with the copy resource + foo.sh # <-- script files for use with the script resource + vars/ # + main.yml # <-- variables associated with this role + defaults/ # + main.yml # <-- default lower priority variables for this role + meta/ # + main.yml # <-- role dependencies and optional Galaxy info + library/ # roles can also include custom modules + module_utils/ # roles can also include custom module_utils + lookup_plugins/ # or other types of plugins, like lookup in this case + + webtier/ # same kind of structure as "common" was above, done for the webtier role + monitoring/ # "" + fooapp/ # "" +``` \ No newline at end of file diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..3ca5142 --- /dev/null +++ b/requirements.in @@ -0,0 +1,2 @@ +ansible +pip-tools \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d62e6af --- /dev/null +++ b/requirements.txt @@ -0,0 +1,53 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile --output-file=requirements.txt requirements.in +# +ansible==8.7.0 + # via -r requirements.in +ansible-core==2.15.8 + # via ansible +build==1.0.3 + # via pip-tools +cffi==1.16.0 + # via cryptography +click==8.1.7 + # via pip-tools +cryptography==41.0.7 + # via ansible-core +importlib-metadata==7.0.1 + # via build +importlib-resources==5.0.7 + # via ansible-core +jinja2==3.1.3 + # via ansible-core +markupsafe==2.1.3 + # via jinja2 +packaging==23.2 + # via + # ansible-core + # build +pip-tools==7.3.0 + # via -r requirements.in +pycparser==2.21 + # via cffi +pyproject-hooks==1.0.0 + # via build +pyyaml==6.0.1 + # via ansible-core +resolvelib==1.0.1 + # via ansible-core +tomli==2.0.1 + # via + # build + # pip-tools + # pyproject-hooks +wheel==0.42.0 + # via pip-tools +zipp==3.17.0 + # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/roles/role_change_me/files/.gitkeep b/roles/role_change_me/files/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/roles/role_change_me/tasks/main.yml b/roles/role_change_me/tasks/main.yml new file mode 100644 index 0000000..f76ffcd --- /dev/null +++ b/roles/role_change_me/tasks/main.yml @@ -0,0 +1 @@ +# Tasks here! \ No newline at end of file diff --git a/roles/role_change_me/templates/.gitkeep b/roles/role_change_me/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/roles/role_change_me/vars/main.yml b/roles/role_change_me/vars/main.yml new file mode 100644 index 0000000..e57ef22 --- /dev/null +++ b/roles/role_change_me/vars/main.yml @@ -0,0 +1 @@ +# Vars