blob: 31548a66f15c1f27639bae7ca0b6670c4b430231 [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: true
when: ansible_os_family == 'Debian'
# - name: inventory_hostname var
# debug:
# var: inventory_hostname
# - name: user var
# debug:
# var: user
# TODO: fix propagating delegation and become_user
# - include: install_deps_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml
# 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
# become: true
# become_user: "{{user}}"
- 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