Ansible scripts pour xxxxxxxxx.yyy.zzz

Liste des scripts

 189 -rwxrwxrwx 1 root root  373 juin   7 07:46 intranet_dev.bash
 321 -rwxrwxrwx 1 root root  638 juin   7 07:46 README.md
 193 -rwxrwxrwx 1 root root  379 avril 25 15:49 transaction_dev.bash
2049 -rwxrwxrwx 1 root root 1731 juil. 13 12:42 transaction_prod.bash
 229 -rwxrwxrwx 1 root root  452 juil. 13 12:42 transaction_prod_https.bash
2049 -rwxrwxrwx 1 root root 1749 juin  12 07:56 transaction_staging.bash
2049 -rwxrwxrwx 1 root root 1012 juin  12 07:56 update_dev.bash
2049 -rwxrwxrwx 1 root root 1239 juil.  4 15:22 update_prod.bash
 225 -rwxrwxrwx 1 root root  442 juin  12 07:56 update_prod_https.bash
2049 -rwxrwxrwx 1 root root 1248 juin  12 07:56 update_staging.bash
2049 -rwxrwxrwx 1 root root 1023 juil. 13 12:42 view-license_prod.bash

transaction_prod.bash

 1     #!/bin/bash
 2
 3     # download last logtransactions_xxxxx.git
 4     /usr/bin/rm /etc/ansible/roles/django_project/files/transaction/logtransactions_xxxxx.tar.gz
 5     cd /etc/ansible/roles/django_project/files/transaction/
 6     /usr/bin/git clone http://gitdeploy:XXXX@gitlab.XXXX/Informatique/logtransactions_xxxxx.git
 7     cd /etc/ansible/roles/django_project/files/transaction/logtransactions_xxxxx/
 8     /usr/bin/tar zcvf /etc/ansible/roles/django_project/files/transaction/logtransactions_xxxxx.tar.gz *
 9     /usr/bin/rm -R /etc/ansible/roles/django_project/files/transaction/logtransactions_xxxxx/
10
11     # download last db
12     STATE=$(grep -o "#enable_download_last_db=0" /etc/ansible/playbook/prod/transaction-prod.yml)
13     STATE1=$(grep -o "#enable_download_last_db=1" /etc/ansible/playbook/prod/transaction-prod.yml)
14
15     if [ "$STATE" == "#enable_download_last_db=0" ]; then
16      echo "no need to download last transaction db"
17     elif [ "$STATE1" == "#enable_download_last_db=1" ]; then
18       echo "db_copy_import role is present in playbook, so need to download last db backup"
19       /usr/bin/rm /etc/ansible/roles/db_copy_import/files/transaction/db.dump.tar.gz
20       /usr/bin/cp /root/scripts/output_backup/db.dump_$(date +%F).tar.gz /etc/ansible/roles/db_copy_import/files/transaction/db.dump.tar.gz
21     else
22       echo "bug"
23     fi
24
25     ARGS=$*
26     PLAY1="/etc/ansible/playbook/prod/transaction-prod.yml"
27     INV="/etc/ansible/inventory/hosts"
28     TYPE="transaction-prod"
29
30     #Configure app
31     cd /etc/ansible
32     #/usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE"" $ARG
33     /usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE"" -vvv
34     #/usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE""
35     #/usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE"" -vvv --check

transaction_prod_https.bash

 1     #!/bin/bash
 2
 3     ARGS=$*
 4     PLAY1="/etc/ansible/playbook/prod/transaction-prod-https.yml"
 5     INV="/etc/ansible/inventory/hosts"
 6     TYPE="transaction-prod"
 7
 8     #Configure app
 9     cd /etc/ansible
10     #/usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE"" $ARG
11     /usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE"" -vvv
12     #/usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE""
13     #/usr/bin/ansible-playbook "$PLAY1" -i "$INV" -e "type="$TYPE"" -vvv --check