{"id":15081527,"url":"https://github.com/pvdabbeele/ansible","last_synced_at":"2026-01-03T00:49:03.926Z","repository":{"id":184154451,"uuid":"671397770","full_name":"pvdabbeele/Ansible","owner":"pvdabbeele","description":"An Ansible repo with pluggable roles","archived":false,"fork":false,"pushed_at":"2023-08-01T13:27:20.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T19:17:34.490Z","etag":null,"topics":["ansible","ansible-playbook","ansible-playbooks","ansible-role","ansible-roles","httpd","jinja2","mariadb","nginx","php","php-fpm","postgresql","rhel","vaultwarden","yaml"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pvdabbeele.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-27T08:20:07.000Z","updated_at":"2024-03-22T13:41:07.000Z","dependencies_parsed_at":"2023-09-07T00:01:39.836Z","dependency_job_id":null,"html_url":"https://github.com/pvdabbeele/Ansible","commit_stats":null,"previous_names":["pvdabbeele/plugg-ansible","pvdabbeele/ansible"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdabbeele%2FAnsible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdabbeele%2FAnsible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdabbeele%2FAnsible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdabbeele%2FAnsible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvdabbeele","download_url":"https://codeload.github.com/pvdabbeele/Ansible/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918630,"owners_count":20368745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-playbook","ansible-playbooks","ansible-role","ansible-roles","httpd","jinja2","mariadb","nginx","php","php-fpm","postgresql","rhel","vaultwarden","yaml"],"created_at":"2024-09-25T06:00:35.736Z","updated_at":"2026-01-03T00:49:03.862Z","avatar_url":"https://github.com/pvdabbeele.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pluggable Ansible\n\n## purpose\n\nAn Ansible repo with pluggable roles, such as:\n- application servers: Jboss/Wildfly\n- databases: MySQL/MariaDB, PostgreSQL\n- scripting languages: PHP\n- webservers: Apache2 (httpd), Nginx\n\n## prerequisites\n- RHEL (preferably 8)\n- Ansible (preferably 2.12 or higher)\n- an Ansible service account with authorized ssh login\n- Vaultwarden with *community.general.bitwarden* installed\n- an inventory, something like this would be lovely:\n```yml\n[applications]\nmy_app.local\n[databases]\nmy_db.local\n```\n### two-tier\nAbove notation gives you the ability to tell Ansible: use the *\"other tier\"*:\n```yml\n{{ hostvars[groups['applications'][0]]['inventory_hostname'] }}\n```\n\n## content\n- pluggable roles that can perform a **default** installation of aforementioned components\n- a customization role that performs a **specific** installation and/or configuration\n- installing PostgreSQL, or Nginx, does only that: the installation of a software package, without any project related details\n- the custom role is designed for the latter: the creation of database, the configuration of a webserver\n\n## variables\nThe idea is to centralize variables, and to define default values, as much as possible.\n\n### defaults\n\n- try to define **default** values as often as possible, in your YAML or Jinja2 syntax\n- grouping the variables into **one file** improves readability\n- refering to your variables is an easy syntax, for example: {{ mariadb.port }}\n\n```yml\n# {{ ansible_managed }}\n[mariadb]\ndatadir = {{ mariadb.data_dir | default('/var/lib/mysql/', true) }}\ngeneral_log_file = {{ mariadb.log_dir | default('/var/log/mariadb', true) }}/mariadb.log\ngeneral_log = 1\nlog-error = {{ mariadb.log_dir | default('/var/log/mariadb', true) }}/mariadb_error.log\nlog_bin = {{ mariadb.log_dir | default('/var/log/mariadb', true) }}/mariadb_bin\nport = {{ mariadb.port | default('3306', true) }}\n```\n\n### defaults/main.yml (excerpt)\n\n```yml\nmariadb:\n  config_file: /etc/my.cnf\n  data_dir: /var/lib/mysql/\n  group: mysql\n  log_dir: /var/log/mariadb/\n  logs:\n    - mariadb.log\n    - mariadb_error.log\n  owner: mysql\n  packages:\n    - { package: 'mariadb-server', state: 'present' }\n    - { package: 'mariadb-connector-c', state: 'present' }\n    - { package: 'python3-PyMySQL', state: 'present' }\n    - { package: 'perl-DBD-MySQL', state: 'present' }\n  port: 3306\n```\n## customize\n\nAfter a *default installation*, that is: no customization added, your setup will look like this:\n- databases: PostgreSQL or MySQL does not contain anything project related, the server is initialized, the passwords retrievable from Vaultwarden\n- webservers: no vhosts (Apache2) or server blocks (Nginx) are created, your configuration is *stripped from default values* and should be secure\n- In case you need something specific, adapt the required variables and *change only the custom role*.\n\n## usage\n\nvalues between square brackets are optional **[ ]** or an array of options **[ x | y ]** :\n\n```yml\nansible-playbook [ -l \u003chosts\u003e | -i \u003cinventory\u003e ] [ --become ] [ --check ] -e \"env=\u003cenvironment\u003e [ database_type= mariadb | postgresql ] \n     [ webserver_type= httpd | nginx ] [ scripting_language=php ]\" [ application_server_type=jboss ] site.yml\n```\n\n## license\nGPLv3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvdabbeele%2Fansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvdabbeele%2Fansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvdabbeele%2Fansible/lists"}