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
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z ${WRESTLINGDEV_DB_USER} ]; then
|
if [ -z ${WRESTLINGDEV_DB_USR} ]; then
|
||||||
echo "WRESTLINGDEV_DB_USER not set"
|
echo "WRESTLINGDEV_DB_USR not set"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,6 @@
|
|||||||
repository: https://github.com/jcwimer/wrestlingApp.git
|
repository: https://github.com/jcwimer/wrestlingApp.git
|
||||||
root_mysql_password: something
|
root_mysql_password: something
|
||||||
heroku_jcw_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
|
- name: Install git
|
||||||
apt: name=git state=present
|
apt: name=git state=present
|
||||||
|
|
||||||
- name: Install tmux
|
|
||||||
apt: name=tmux state=prsent
|
|
||||||
|
|
||||||
- name: Install rsync
|
- name: Install rsync
|
||||||
apt: name=rsync state=present
|
apt: name=rsync state=present
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
apt: name=python-mysqldb state=installed
|
apt: name=python-mysqldb state=installed
|
||||||
|
|
||||||
- name: Replace config file
|
- 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
|
- name: Stop mysql service
|
||||||
service: name=mysql state=stop
|
service: name=mysql state=stopped
|
||||||
|
|
||||||
|
|||||||
@@ -2,21 +2,22 @@
|
|||||||
# This starts the galera cluster
|
# This starts the galera cluster
|
||||||
|
|
||||||
# Check if mysql is running
|
# Check if mysql is running
|
||||||
- name: bootstrap by starting mysql with gcom://
|
- name: is mysql running?
|
||||||
action: shell /etc/init.d/mysql start --wsrep-cluster-address="gcomm://"
|
action: shell service mysql status
|
||||||
only_if: ${is_mysql_running.rc} > 0
|
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
|
- name: Create wrestlingtourney database
|
||||||
action: shell mysql -e "CREATE DATABASE wrestlingtourney;"
|
action: shell mysql -e "CREATE DATABASE wrestlingtourney;"
|
||||||
|
|
||||||
- name: set mysql root password
|
- name: set mysql root password
|
||||||
action: shell mysql -e "UPDATE mysql.user SET password=PASSWORD('$root_mysql_password') where user='root'; FLUSH PRIVILEGES;"
|
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
|
- name: Set up haproxy_check user
|
||||||
action: shell mysql -u root -p -e "INSERT INTO mysql.user (Host,User) values ('%','haproxy_check'); FLUSH PRIVILEGES;"
|
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
|
- 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;"
|
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
|
# This starts the mysql service
|
||||||
|
|
||||||
- name: Start 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
|
apt: name=haproxy state=present
|
||||||
|
|
||||||
- name: Create haproxy config file
|
- 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
|
- name: Enable init script
|
||||||
replace: dest='/etc/default/haproxy'
|
replace: dest='/etc/default/haproxy'
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ listen mysql-cluster
|
|||||||
mode tcp
|
mode tcp
|
||||||
option mysql-check user haproxy_check
|
option mysql-check user haproxy_check
|
||||||
balance roundrobin
|
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
|
server {{ hostvars[db_server]['ansible_eth1']['ipv4']['address'] }} {{ hostvars[db_server]['ansible_eth1']['ipv4']['address'] }}:3306 check
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -39,6 +39,6 @@ backend wrestlingdev
|
|||||||
redirect scheme https if !{ ssl_fc }
|
redirect scheme https if !{ ssl_fc }
|
||||||
balance roundrobin
|
balance roundrobin
|
||||||
cookie SERVERID insert indirect nocache
|
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
|
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 %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -17,6 +17,11 @@
|
|||||||
- name: Set db password
|
- name: Set db password
|
||||||
shell: echo export WRESTLINGDEV_DB_PWD={{ lookup('env', 'WRESTLINGDEV_DB_PWD') }} >> /var/www/html/prod.env
|
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
|
- name: Set db host
|
||||||
shell: echo export WRESTLINGDEV_DB_HOST={{ lookup('env', 'WRESTLINGDEV_DB_HOST') }} >> /var/www/html/prod.env
|
shell: echo export WRESTLINGDEV_DB_HOST={{ lookup('env', 'WRESTLINGDEV_DB_HOST') }} >> /var/www/html/prod.env
|
||||||
|
|
||||||
|
|||||||
4
site.yml
4
site.yml
@@ -1,6 +1,10 @@
|
|||||||
---
|
---
|
||||||
# This playbook deploys the whole application stack for wrestlingdev
|
# This playbook deploys the whole application stack for wrestlingdev
|
||||||
#
|
#
|
||||||
|
- name: Gather facts for all
|
||||||
|
hosts: all
|
||||||
|
remote_user: root
|
||||||
|
gather_facts: true
|
||||||
|
|
||||||
- include: playbooks/galeradb.yml
|
- include: playbooks/galeradb.yml
|
||||||
- include: playbooks/proxy.yml
|
- include: playbooks/proxy.yml
|
||||||
|
|||||||
Reference in New Issue
Block a user