Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backups to Ansible scripts #68

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions ansible/install-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
- name: check for secrets file
stat: path="{{ cs_root }}/cs-secrets.properties"
register: cssecrets
- name: fail if secrets file not found
- name: fail if secrets file not found
fail: msg="secrets file not preloaded on target"
when: not cssecrets.stat.exists

# copy cs properties file
# change restarts tomcat
- name: copy properties file
Expand All @@ -29,6 +29,7 @@
dest: "{{ cs_root }}/cs.properties"
group: iam-dev
mode: 0664
backup: true
notify: restart tomcat

# update http and https config
Expand All @@ -39,6 +40,7 @@
dest: /data/conf/apache.conf.d/http.cs
group: iam-dev
mode: 0664
backup: true
notify: restart apache

- name: copy https apache config
Expand All @@ -47,25 +49,27 @@
dest: /data/conf/apache.conf.d/https.cs
group: iam-dev
mode: 0664
backup: true
notify: restart apache

# update the cs.war file
- name: copy cs.war
copy:
copy:
src: "{{ proj_root }}/target/cs.war"
dest: /data/local/wars/cs.war
group: iam-dev
mode: 0664
register: warfile
backup: true

# unpack the cs.war file
- name: unpack cs.war
shell: "rm -rf /data/webapps/cs; mkdir /data/webapps/cs; cd /data/webapps/cs; jar xf /data/local/wars/cs.war"
when: warfile.changed
# When unzipping, use -DD to update the last modified time of each extracted file
# Otherwise, the browser cache will not pick up the new version of the file!
shell: "rm -rf /data/webapps/cs; mkdir /data/webapps/cs; cd /data/webapps/cs; unzip -DD /data/local/wars/cs.war"
notify:
- restart tomcat

# run any handlers
# run any handlers
- meta: flush_handlers

handlers:
Expand All @@ -84,6 +88,3 @@
shell: "c=0;while [ $c -lt 20 ]; do [[ \"`curl -k -f https://localhost/tomcatmanager/text/list 2>/dev/null | grep 'cs'`\" =~ 'cs' ]] && exit 0; let c=c+1;sleep 5; done; exit 1"
register: wait_result
failed_when: "wait_result.rc != 0"



Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static int parseCsr(CBCertificate cert) throws CBParseException {

} catch (Exception e) {
log.debug("request DN parse exception: " + e);
throw new CBParseException("e.getMessage()");
throw new CBParseException(e.getMessage());
}
// see if we've got alt names (in extensions)

Expand All @@ -136,7 +136,7 @@ public static int parseCsr(CBCertificate cert) throws CBParseException {
}
} catch (Exception e) {
log.debug("ignoring request ATTR parse exception: " + e);
// throw new CBParseException("e.getMessage()");
// throw new CBParseException(e.getMessage());
}
}

Expand All @@ -154,7 +154,7 @@ public static int parseCsr(CBCertificate cert) throws CBParseException {

} catch (Exception e) {
log.debug("request KEY parse exception: " + e);
throw new CBParseException("e.getMessage()");
throw new CBParseException(e.getMessage());
}
return 1;
}
Expand Down