Skip to content
Snippets Groups Projects
Commit c9c477d4 authored by Niculut Laurentiu's avatar Niculut Laurentiu
Browse files

added output examples

parent 2afd0b52
No related branches found
No related tags found
No related merge requests found
......@@ -6,14 +6,9 @@
pre_tasks:
- name: Install MySQL
apt: name={{ item }} update_cache=yes cache_valid_time=3600 state=present
###OS###: name={{ item }} update_cache=yes cache_valid_time=3600 state=present
with_items:
- mysql-server
- mysql-client
- python-setuptools
- python-mysqldb
- libmysqlclient-dev
- python3-pip
###OS_PACKETS###
- name: Remove a symbolic link
ansible.builtin.file:
......
......@@ -33,6 +33,8 @@ class AnsibleModule:
def edit_template(self, template_type, template_list, template_data, kind):
if template_type == "postgres":
new_file = ansibleUtils.databases_postgres(template_list, template_data, kind)
if template_type == "mysql":
new_file = ansibleUtils.databases_mysql(template_list, template_data, kind)
if template_type == "wordpress":
new_file = ansibleUtils.service_wordpress(template_list, template_data, kind)
return new_file
......
......@@ -20,6 +20,17 @@ def databases_postgres(template_list, template_data, kind):
new_template_list = generic_matcher(template_list, specific_data)
return "".join(new_template_list)
def databases_mysql(template_list, template_data, kind):
if kind == "vars":
new_template_list = generic_matcher(template_list, template_data[kind])
if kind == "play":
if template_data[kind]["OS"] == "debian":
specific_data = {"OS": "apt", "OS_PACKETS": " - mysql-server\n - mysql-client\n - python-setuptools\n - python-mysqldb\n - libmysqlclient-dev\n - python3-pip"}
elif template_data[kind]["OS"] == "centos":
specific_data = {"OS": "yum", "OS_PACKETS": " - postgresql10\n - postgresql10-server\n - postgresql10-contrib\n - postgresql10-libs"}
new_template_list = generic_matcher(template_list, specific_data)
return "".join(new_template_list)
def service_wordpress(template_list, template_data, kind):
if kind == "vars":
new_template_list = generic_matcher(template_list, template_data[kind])
......
......@@ -44,7 +44,7 @@
"type":"database",
"output_path": "Output-code/",
"info" : {
"name" : "postgres",
"name" : "mysql",
"template_path" : "Databases-templates/"
},
"data":{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment