diff --git a/ansible/install-app.yml b/ansible/install-app.yml index 981573e..70cac28 100644 --- a/ansible/install-app.yml +++ b/ansible/install-app.yml @@ -25,7 +25,7 @@ mode: 0664 notify: - restart tomcat - + # configure tomcat startup properties # change restarts tomcat # - name: tomcat startup params @@ -50,7 +50,7 @@ notify: restart apache # copy the attributes data file - # until this is in the database + # until this is in the database - name: copy attribute data copy: "src=../attribute.xml dest={{ spreg_root }}/attribute.xml group=iam-dev mode=664" notify: restart tomcat @@ -75,9 +75,18 @@ - name: copy xmlsectool synchronize: "src=../xmlsectool dest={{ spreg_root }} " - # run any handlers + # run any handlers - meta: flush_handlers + # Do a basic smoke test + - name: smoke test (fetch url) + uri: + url: https://iam-tools-test.u.washington.edu/spreg/ + method: GET + return_content: true + register: this + failed_when: this is failed or "'Login with your UW NetID' not in this.content" + # handlers mostly standard from iam-ansible handlers: diff --git a/ansible/install.sh b/ansible/install.sh index 5e5bdea..0759c38 100755 --- a/ansible/install.sh +++ b/ansible/install.sh @@ -63,6 +63,8 @@ while getopts 'h?l:Hvdp:' opt; do ;; p) playbook=$OPTARG ;; + y) force=1 + ;; esac done @@ -73,6 +75,21 @@ target="$2" [[ "$target" == "eval" || "$target" == "prod" || "$target" == "targets" ]] || usage [[ "$target" != "targets" ]] || targets [[ -z $playbook ]] && playbook="install-${product}.yml" + +if [[ $target =~ "prod" && force -eq 0 ]] +then + target= + read -p "Are you sure you want to push prod? [yN] " -r -n1 + echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + target="prod" + else + echo "Aborting" + exit 1 + fi +fi + echo "Installing $playbook to $target" [[ -r $playbook ]] || { echo "Playbook $playbook not found!" @@ -114,7 +131,7 @@ END } -# run the installer +# run the installer vars= (( verb>0 )) && vars="$vars -v " @@ -124,4 +141,3 @@ vars= vars="$vars -l $limit " } ansible-playbook ${playbook} $vars -i ./hosts --extra-vars "target=${target}" -