Last active
May 7, 2017 15:47
-
-
Save SergeyPirogov/af0a2fb19951c9ca5f354e42825f3a66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[client] | |
user=root | |
password=root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir ansible_proj | |
cd ansible_proj | |
mkdir roles | |
# create ansible.cfg with default data | |
echo "[defaults] | |
inventory=hosts | |
nocows=1" > ansible.cfg | |
# create hosts file | |
echo "# 192.168.0.105" > hosts | |
touch playbook.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
become: true | |
vars: | |
ip: hostvars[inventory_hostname]['ansible_default_ipv4']['address'] | |
tasks: | |
- debug: var={{ ip }} | |
# - name: docker | |
# docker_container: | |
# name: mysql | |
# image: "mysql:5.5" | |
# state: started | |
# ports: | |
# - "3306:3306" | |
# env: "MYSQL_ROOT_PASSWORD=root" | |
- name: Copy database dump file to {{inventory_hostname}} | |
copy: | |
src: /home/sergey/ansible/arvi_qa_clean_4_11_2017.sql | |
dest: /tmp | |
- name: Copy my.cnf file to {{inventory_hostname}} | |
copy: | |
src: /home/sergey/ansible/.my.cnf | |
dest: /home/sergey | |
- name: Install mysql python module | |
pip: name=MySQL-python | |
- name: Restore database at {{inventory_hostname}} | |
mysql_db: | |
login_host: '{{inventory_hostname}}' | |
name: db_dev | |
config_file: /home/sergey/.my.cnf | |
state: import | |
target: /tmp/qa_clean_4_11_2017.sql | |
- name: Copy sql script to {{inventory_hostname}} | |
copy: | |
src: /home/sergey/ansible/update.sql | |
dest: /tmp | |
- name: Import file.sql similar to mysql -u <username> -p <password> < hostname.sql | |
mysql_db: | |
login_host: '{{inventory_hostname}}' | |
config_file: /home/sergey/.my.cnf | |
state: import | |
name: arvi_dev | |
target: /tmp/update.sql | |
tags: | |
- update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
become: true | |
tasks: | |
- name: "Clone repo" | |
git: | |
repo: https://github.com/SergeyPirogov/video-recorder-java.git | |
dest: /home/sergey/VideoRecorder | |
version: master | |
clone: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update arvi_facadeintegration_api_product_get | |
set created_at = now(), | |
response = null, | |
toDate = date_format(now(),"%Y-%m-%dT%T:%f") | |
where id = 9582; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment