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

added output examples

parent 5bb28603
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment