Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICG - Infrastucture as Code Generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIACERE
public
The Platform
ICG - Infrastucture as Code Generator
Commits
2afd0b52
Commit
2afd0b52
authored
3 years ago
by
Niculut Laurentiu
Browse files
Options
Downloads
Patches
Plain Diff
added output examples
parent
5bb28603
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Databases-templates/mysql-play.tpl
+53
-12
53 additions, 12 deletions
Databases-templates/mysql-play.tpl
Docker-services-templates/wordpress-play.tpl
+37
-2
37 additions, 2 deletions
Docker-services-templates/wordpress-play.tpl
ansibleUtils.py
+1
-1
1 addition, 1 deletion
ansibleUtils.py
with
91 additions
and
15 deletions
Databases-templates/mysql-play.tpl
+
53
−
12
View file @
2afd0b52
...
...
@@ -10,12 +10,37 @@
with_items:
- mysql-server
- mysql-client
- python-mysqldb
- python-setuptools
- python-
pip
- python-
mysqldb
- libmysqlclient-dev
- python3-pip
- name: Remove a symbolic link
ansible.builtin.file:
path: /usr/bin/python
state: absent
- name: Create a symbolic link
ansible.builtin.file:
src: /usr/bin/python3
dest: /usr/bin/python
state: link
register: result
retries: 3
delay: 5
until: result is not failed
- name: "Install Python packages"
- name: Create a symbolic link
ansible.builtin.file:
src: /usr/bin/pip3
dest: /usr/bin/pip
state: link
register: result
retries: 3
delay: 5
until: result is not failed
- name: Install Python packages
pip: "name={{ item }} state=present"
with_items:
- PyMySQL
...
...
@@ -33,6 +58,25 @@
state: started
enabled: true
- name: Creation mysql file configuration
file:
path: "/root/.my.cnf"
state: touch
- name: Editing configuration file
replace:
path: /etc/mysql/mysql.conf.d/mysqld.cnf
regexp: '(.*bind-addres.*)'
replace: '#\1'
- name: Restart MySQL
service: name=mysql state=restarted
- name: Ensure MySQL started
service:
name: mysql
state: started
- name: update mysql password for application account
mysql_user:
login_unix_socket: /var/run/mysqld/mysqld.sock
...
...
@@ -46,13 +90,10 @@
priv: "*.*:ALL,GRANT"
- name: Add the application database
mysql_db: name="{{ db_name }}" state=present
- name: Editing configuration file
replace:
path: /etc/mysql/mysql.conf.d/mysqld.cnf
regexp: '(.*bind-addres.*)'
replace: '#\1'
mysql_db:
name: "{{ db_name }}"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Restart MySQL
service: name=mysql state=restarted
This diff is collapsed.
Click to expand it.
Docker-services-templates/wordpress-play.tpl
+
37
−
2
View file @
2afd0b52
...
...
@@ -3,7 +3,7 @@
become: yes
vars_files:
-
wordpress-
vars.yml
- vars.yml
pre_tasks:
- name: "Install packages"
...
...
@@ -11,12 +11,47 @@
with_items:
###OS_PACKETS###
- name: Remove a symbolic link
ansible.builtin.file:
path: /usr/bin/python
state: absent
- name: Create a symbolic link
ansible.builtin.file:
src: /usr/bin/python3
dest: /usr/bin/python
state: link
register: result
retries: 3
delay: 5
until: result is not failed
- name: Create a symbolic link
ansible.builtin.file:
src: /usr/bin/pip3
dest: /usr/bin/pip
state: link
register: result
retries: 3
delay: 5
until: result is not failed
- name: "Install Python packages"
pip: "name={{ item }} state=present"
with_items:
- docker
- name: edit firewall
service:
name: ufw
state: stopped
enabled: false
tasks:
- name: Create a volume
community.docker.docker_volume:
name: mydata
- name: Start a WP container
community.docker.docker_container:
name: wordpress
...
...
@@ -30,5 +65,5 @@
WORDPRESS_TABLE_PREFIX: "{
{
WORDPRESS_TABLE_PREFIX
}
}"
ports:
- "8080:80"
volumes
_from
:
volumes:
- mydata
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ansibleUtils.py
+
1
−
1
View file @
2afd0b52
...
...
@@ -25,7 +25,7 @@ def service_wordpress(template_list, template_data, kind):
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
"
:
"
- docker
\n
- docker.io
"
}
specific_data
=
{
"
OS
"
:
"
apt
"
,
"
OS_PACKETS
"
:
"
-
python3
\n
- python3-pip
\n
-
docker
\n
- docker.io
"
}
elif
template_data
[
kind
][
"
OS
"
]
==
"
centos
"
:
specific_data
=
{
"
OS
"
:
"
yum
"
,
"
OS_PACKETS
"
:
"
- docker
"
}
new_template_list
=
generic_matcher
(
template_list
,
specific_data
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment