Skip to content
Snippets Groups Projects
Commit b96b95ee authored by Jupiter Hu's avatar Jupiter Hu
Browse files

Fixed mysql for centos 7

parent 4bebaf89
No related branches found
No related tags found
No related merge requests found
...@@ -7,14 +7,6 @@ ...@@ -7,14 +7,6 @@
- apache2-dev - apache2-dev
sudo: true sudo: true
-
name: "Setting default-ssl site"
lineinfile: dest=/etc/apache2/sites-available/default-ssl.conf regexp="{{ item.regexp }}" line="{{ item.line }}" backrefs=yes
with_items:
- { regexp : "^\\s+SSLCertificateFile", line : " SSLCertificateFile {{ x509_cert_file }}" }
- { regexp : "SSLCertificateKeyFile", line : " SSLCertificateKeyFile {{ x509_key_file }}" }
- { regexp : "SSLCACertificateFile", line : " SSLCACertificateFile {{ x509_cacert_file }}" }
sudo: true
- -
name: "Templating default-ssl site" name: "Templating default-ssl site"
template: src=default-ssl.j2 dest=/etc/apache2/sites-available/default-ssl.conf owner=www-data group=www-data template: src=default-ssl.j2 dest=/etc/apache2/sites-available/default-ssl.conf owner=www-data group=www-data
......
...@@ -14,14 +14,12 @@ ...@@ -14,14 +14,12 @@
name: Setting httpd.conf name: Setting httpd.conf
sudo: true sudo: true
replace: dest=/etc/httpd/conf/httpd.conf regexp="^#ServerName www.example.com:80" replace="ServerName {{ ansible_fqdn }}" replace: dest=/etc/httpd/conf/httpd.conf regexp="^#ServerName www.example.com:80" replace="ServerName {{ ansible_fqdn }}"
- -
name: Setting ssl.conf name: "Templating default-ssl site"
template: src=default-ssl.j2 dest=/etc/httpd/conf.d/ssl.conf owner=apache group=apache
sudo: true sudo: true
lineinfile: dest=/etc/httpd/conf.d/ssl.conf regexp="{{ item.regexp }}" line="{{ item.line }}" backrefs=yes
with_items:
- { regexp : "^SSLCertificateFile", line : "SSLCertificateFile {{ x509_cert_file }}" }
- { regexp : "SSLCertificateKeyFile", line : "SSLCertificateKeyFile {{ x509_key_file }}" }
- { regexp : "SSLCACertificateFile", line : "SSLCACertificateFile {{ x509_cacert_file }}" }
- -
name: Templating wsgi.conf name: Templating wsgi.conf
sudo: true sudo: true
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
- python-cracklib - python-cracklib
- git - git
- apache2-dev - apache2-dev
- mysql-client
- python-dev
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- -
name: "Installing prerequisites Redhat" name: "Installing prerequisites Redhat"
...@@ -55,7 +57,6 @@ ...@@ -55,7 +57,6 @@
sudo: true sudo: true
with_items: with_items:
- six - six
- MySQL-python
- slimit - slimit
- ply - ply
- cython - cython
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
# certificate chain for the server certificate. Alternatively # certificate chain for the server certificate. Alternatively
# when the CA certificates are directly appended to the server # when the CA certificates are directly appended to the server
# certificate for convinience. # certificate for convinience.
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt SSLCertificateChainFile {{ x509_cert_chain }}
# Certificate Authority (CA): # Certificate Authority (CA):
# Set the CA certificate verification path where to find CA # Set the CA certificate verification path where to find CA
...@@ -59,13 +59,6 @@ ...@@ -59,13 +59,6 @@
# Note: Inside SSLCACertificatePath you need hash symlinks # Note: Inside SSLCACertificatePath you need hash symlinks
# to point to the certificate files. Use the provided # to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes. # Makefile to update the hash symlinks after changes.
{% if ldapCaCertFile is defined and ldapCaCertDir is defined %}
SSLCACertificatePath {{ ldapCaCertDir }}
SSLCACertificateFile {{ ldapCaCertDir }}/{{ ldapCaCertFile }}
{% else %}
SSLCACertificatePath /etc/ssl/certs/
SSLCACertificateFile {{ x509_cacert_file }}
{% endif %}
# Certificate Revocation Lists (CRL): # Certificate Revocation Lists (CRL):
# Set the CA revocation path where to find CA CRLs for client # Set the CA revocation path where to find CA CRLs for client
......
...@@ -99,21 +99,21 @@ ...@@ -99,21 +99,21 @@
with_items: ldapCertFiles with_items: ldapCertFiles
sudo: true sudo: true
- name: copy cert #- name: copy cert
command: cp /etc/ssl/certs/server.crt {{ ldapcert }} # command: cp /etc/ssl/certs/server.crt {{ ldapcert }}
sudo: true # sudo: true
- name: copy cacert #- name: copy cacert
command: cp /etc/ssl/certs/ca.crt {{ cacert }} # command: cp /etc/ssl/certs/ca.crt {{ cacert }}
sudo: true # sudo: true
- name: copy key #- name: copy key
command: cp /etc/ssl/private/server.key {{ ldapkey }} # command: cp /etc/ssl/private/server.key {{ ldapkey }}
sudo: true # sudo: true
- name: chmod key #- name: chmod key
file: path={{ ldapkey }} owner={{ ldapuser }} group={{ ldapgroup }} mode=600 # file: path={{ ldapkey }} owner={{ ldapuser }} group={{ ldapgroup }} mode=600
sudo: true # sudo: true
- name: enable ssl centos - name: enable ssl centos
lineinfile: regexp="SLAPD_LDAPS=no" state=present line="SLAPD_LDAPS=yes" dest=/etc/sysconfig/ldap lineinfile: regexp="SLAPD_LDAPS=no" state=present line="SLAPD_LDAPS=yes" dest=/etc/sysconfig/ldap
......
--- ---
- include: mysql_client.yml mysql_type=mysql_client - include_vars: "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml"
- include: mysql_server.yml mysql_type=mysql_server - include: "{{ mysql_type }}.yml"
--- ---
- name: "Installing MySQL Debian" - name: "Installing MySQL Debian"
apt: name="{{ item }}" update_cache=yes cache_valid_time=3600 state=present apt: name="{{ item }}" update_cache=yes cache_valid_time=3600 state=present
with_items: with_items: server_packages
- python
- python-dev
- libmysqlclient-dev
- python-pip
- libapache2-mod-wsgi
- python-mysql.connector
- mysql-server
- python-mysqldb
sudo: true sudo: true
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: "Remove rdo repo"
file: path=/etc/yum.repos.d/rdo-release.repo state=absent
sudo: true
when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= 7
- name: "Check RPM packages"
shell: ls /etc/yum.repos.d/mysql-community.repo
register: mysql_repo
ignore_errors: true
when: rpm_package is defined
- name: "Add RPM packages"
shell: rpm -iUvh {{ rpm_package }}
sudo: true
when: mysql_repo | failed
- name: Installing MySQL RedHat - name: Installing MySQL RedHat
yum: name="{{ item }}" state=latest yum: name={{ item }}
with_items: with_items: server_packages
- python
- python-devel
- mysql-devel
- mysql-libs
- MySQL-python
- mysql-server
sudo: true sudo: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
...@@ -36,7 +38,8 @@ ...@@ -36,7 +38,8 @@
when: ansible_os_family == "RedHat" and ansible_distribution_major_version < 7 when: ansible_os_family == "RedHat" and ansible_distribution_major_version < 7
- name: "Starting MySQL" - name: "Starting MySQL"
service: name=mariadb state=started enabled=true # service: name=mariadb state=started enabled=true
service: name=mysqld state=started enabled=true
sudo: true sudo: true
when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= 7 when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= 7
......
server_packages:
- python
- python-devel
- mysql-devel
- mysql-libs
- MySQL-python
- mysql-server
rpm_package: "http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm"
server_packages:
- python
- python-devel
- MySQL-python
- mysql-community-server
server_packages:
- python
- python-dev
- libmysqlclient-dev
- python-pip
- libapache2-mod-wsgi
- python-mysql.connector
- mysql-server
- python-mysqldb
server_packages:
- python
- python-dev
- libmysqlclient-dev
- python-pip
- libapache2-mod-wsgi
- python-mysql.connector
- mysql-server
- python-mysqldb
---
mysql_config_file_name: mysql_config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment