A lot of changes based on dry run results
This commit is contained in:
@@ -3,8 +3,8 @@ if [ -z ${WRESTLINGDEV_DB_NAME} ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z ${WRESTLINGDEV_DB_USER} ]; then
|
||||
echo "WRESTLINGDEV_DB_USER not set"
|
||||
if [ -z ${WRESTLINGDEV_DB_USR} ]; then
|
||||
echo "WRESTLINGDEV_DB_USR not set"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,3 +4,6 @@
|
||||
repository: https://github.com/jcwimer/wrestlingApp.git
|
||||
root_mysql_password: something
|
||||
heroku_jcw_password: something
|
||||
proxy_stats_uri: /someplace
|
||||
proxy_stats_user: something
|
||||
proxy_stats_pass: something
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
- name: Install git
|
||||
apt: name=git state=present
|
||||
|
||||
- name: Install tmux
|
||||
apt: name=tmux state=prsent
|
||||
|
||||
- name: Install rsync
|
||||
apt: name=rsync state=present
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
apt: name=python-mysqldb state=installed
|
||||
|
||||
- name: Replace config file
|
||||
template: src=my.cnf.j2 dest=/etc/mysql/my.cnf
|
||||
template: src=../roles/db/templates/my.cnf.j2 dest=/etc/mysql/my.cnf
|
||||
|
||||
- name: Stop mysql service
|
||||
service: name=mysql state=stop
|
||||
service: name=mysql state=stopped
|
||||
|
||||
|
||||
@@ -2,21 +2,22 @@
|
||||
# This starts the galera cluster
|
||||
|
||||
# Check if mysql is running
|
||||
- name: bootstrap by starting mysql with gcom://
|
||||
action: shell /etc/init.d/mysql start --wsrep-cluster-address="gcomm://"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
- name: is mysql running?
|
||||
action: shell service mysql status
|
||||
register: is_mysql_running
|
||||
ignore_errors: true
|
||||
|
||||
- name: bootstrap by starting mysql with new cluster
|
||||
action: shell service mysql start --wsrep-new-cluster
|
||||
|
||||
- name: Create wrestlingtourney database
|
||||
action: shell mysql -e "CREATE DATABASE wrestlingtourney;"
|
||||
|
||||
- name: set mysql root password
|
||||
action: shell mysql -e "UPDATE mysql.user SET password=PASSWORD('$root_mysql_password') where user='root'; FLUSH PRIVILEGES;"
|
||||
only_if: $(is_mysql_running.rc} > 0
|
||||
|
||||
- name: Set up haproxy_check user
|
||||
action: shell mysql -u root -p -e "INSERT INTO mysql.user (Host,User) values ('%','haproxy_check'); FLUSH PRIVILEGES;"
|
||||
only_if: $(is_mysql_running.rc} > 0
|
||||
|
||||
- name: Set up user for wrestlingtourney
|
||||
action: shell mysql -u root -p -e "CREATE USER 'heroku_jcw'@'%' IDENTIFIED BY '($heroku_jcw_password)';GRANT ALL PRIVILEGES ON wrestlingtourney.* TO 'heroku_jcw'@'%'; FLUSH PRIVILEGES;"
|
||||
only_if: $(is_mysql_running.rc} > 0
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# This starts the mysql service
|
||||
|
||||
- name: Start mysql service
|
||||
service: name=mysql state=start
|
||||
service: name=mysql state=started
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
apt: name=haproxy state=present
|
||||
|
||||
- name: Create haproxy config file
|
||||
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
|
||||
template: src=../roles/proxy/templates/haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
|
||||
|
||||
- name: Enable init script
|
||||
replace: dest='/etc/default/haproxy'
|
||||
|
||||
@@ -21,7 +21,7 @@ listen mysql-cluster
|
||||
mode tcp
|
||||
option mysql-check user haproxy_check
|
||||
balance roundrobin
|
||||
{% for db_server in db %}
|
||||
{% for db_server in groups['db'] %}
|
||||
server {{ hostvars[db_server]['ansible_eth1']['ipv4']['address'] }} {{ hostvars[db_server]['ansible_eth1']['ipv4']['address'] }}:3306 check
|
||||
{% endfor %}
|
||||
|
||||
@@ -39,6 +39,6 @@ backend wrestlingdev
|
||||
redirect scheme https if !{ ssl_fc }
|
||||
balance roundrobin
|
||||
cookie SERVERID insert indirect nocache
|
||||
{% for web_server in web %}
|
||||
{% for web_server in groups['web'] %}
|
||||
server {{ hostvars[web_server]['ansible_eth1']['ipv4']['address'] }} {{ hostvars[web_server]['ansible_eth1']['ipv4']['address'] }}:443 check cookie {{ hostvars[web_server]['ansible_eth1']['ipv4']['address'] }} ssl verify none
|
||||
{% endfor %}
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
- name: Set db password
|
||||
shell: echo export WRESTLINGDEV_DB_PWD={{ lookup('env', 'WRESTLINGDEV_DB_PWD') }} >> /var/www/html/prod.env
|
||||
|
||||
|
||||
- name: Set db username
|
||||
shell: echo export WRESTLINGDEV_DB_USR={{ lookup('env', 'WRESTLINGDEV_DB_USR') }} >> /var/www/html/prod.env
|
||||
|
||||
|
||||
- name: Set db host
|
||||
shell: echo export WRESTLINGDEV_DB_HOST={{ lookup('env', 'WRESTLINGDEV_DB_HOST') }} >> /var/www/html/prod.env
|
||||
|
||||
|
||||
Reference in New Issue
Block a user