blob: 458956208888ee0607863677bb3326240e57fa07 [file] [log] [blame]
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
- name: Adds Python MySQL support on Debian/Ubuntu
apt: pkg="python-mysqldb" state=present
become_user: root
when: ansible_os_family == 'Debian'
- name: Adds Python MySQL support on RedHat/CentOS
yum: name=MySQL-python state=present
become_user: root
when: ansible_os_family == 'RedHat'
- name: create django database ({{ django_database_name }})
mysql_db: name="{{ django_database_name }}" state=present encoding=utf8 collation=utf8_bin
- name: give access to {{ django_db_username }} from remote (internal ip)
mysql_user: name="{{ django_db_username }}" password="{{ django_db_password }}" host="{{ ansible_default_ipv4.address }}"
- name: give access to {{ django_db_username }} from remote (public ip)
mysql_user: name="{{ django_db_username }}" password="{{ django_db_password }}" host="{{ ansible_host }}"
- name: give access to {{ django_db_username }} from localhost
mysql_user: name="{{ django_db_username }}" password="{{ django_db_password }}" host="localhost"
- name: create new user {{ django_db_username }} with all privileges on all django databases
mysql_user: name="{{ django_db_username }}"
password="{{ django_db_password }}"
append_privs=yes
host_all=yes
priv={{ django_database_name }}.*:ALL,GRANT state=present