add scripts
parent
846773b7fd
commit
75b8558e11
|
@ -78,6 +78,25 @@
|
|||
- 'common.py'
|
||||
- 'host.py'
|
||||
|
||||
- name: Copy sysadmin scripts to home directory
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "/home/{{ user_name }}/{{ item }}"
|
||||
mode: 0755
|
||||
with_items:
|
||||
- 'setup.sh'
|
||||
- 'dump.sh'
|
||||
|
||||
- name: Copy scripts to deploy directory
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ project_path }}/deploy/{{ item }}"
|
||||
mode: 0755
|
||||
with_items:
|
||||
- 'emit_notices.sh'
|
||||
|
||||
- name: Create django log directory
|
||||
become: yes
|
||||
file:
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
PASSWORD={{ mysql_db_pass }}
|
||||
HOST={{ mysql_db_host }}
|
||||
USER={{ mysql_db_user }}
|
||||
DATABASE={{ mysql_db_name }}
|
||||
DB_FILE=unglue.it.sql
|
||||
EXCLUDED_TABLES=(
|
||||
core_key
|
||||
)
|
||||
|
||||
IGNORED_TABLES_STRING=''
|
||||
for TABLE in "${EXCLUDED_TABLES[@]}"
|
||||
do :
|
||||
IGNORED_TABLES_STRING+=" --ignore-table=${DATABASE}.${TABLE}"
|
||||
done
|
||||
|
||||
echo "Dump structure"
|
||||
mysqldump --host=${HOST} --user=${USER} --password=${PASSWORD} --single-transaction --no-data ${DATABASE} > ${DB_FILE}
|
||||
|
||||
echo "Dump content"
|
||||
mysqldump --host=${HOST} --user=${USER} --password=${PASSWORD} --no-create-info ${DATABASE} ${IGNORED_TABLES_STRING} >> ${DB_FILE}
|
||||
|
||||
echo "gzip the file"
|
||||
gzip -f ${DB_FILE}
|
|
@ -0,0 +1,3 @@
|
|||
cd {{ project_path }}
|
||||
source {{ virtualenv_name }}/bin/activate
|
||||
export DJANGO_SETTINGS_MODULE={{ django_settings_module }}
|
|
@ -0,0 +1,18 @@
|
|||
- hosts: regluit-dev
|
||||
gather_facts: false
|
||||
tasks:
|
||||
# Need to install python2.7 and pip first so Ansible will function
|
||||
# This is due to Ubuntu 16 shipping with Python3 by default
|
||||
- name: Install python2.7 and pip
|
||||
become: true
|
||||
raw: bash -c "apt -qqy update && apt install -qqy python2.7-dev python-pip"
|
||||
register: output
|
||||
changed_when: output.stdout != ""
|
||||
|
||||
- name: Gathering Facts
|
||||
setup:
|
||||
|
||||
- include_role:
|
||||
name: regluit_prod
|
||||
|
||||
|
Loading…
Reference in New Issue