Produced by Araxis Merge on 4/18/2019 5:55:27 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_DevOps\mccf_devops\scripts\shell | installJenkins.sh | Wed Apr 3 02:27:18 2019 UTC |
2 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_DevOps\mccf_devops\scripts\shell | installJenkins.sh | Tue Apr 16 15:27:28 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 426 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | #!/bin/bas h | |
2 | # | |
3 | #set -x | |
4 | ||
5 | scriptname =${0} | |
6 | scriptBase ="$( cd "$ ( dirname "$scriptna me" )"; p wd)" | |
7 | VAULTPASS_ PATH="~/.v ault_pass" | |
8 | REPO_FILE= "jenkins-r equirement s.yml" | |
9 | ROOT_DIR=" $( cd ../. .; pwd)" | |
10 | TIMESTAMP= `date "+%Y %m%d_%H%M% S"` | |
11 | LOG_DIR="$ {ROOT_DIR} /logs" | |
12 | LOGFILE="$ {LOG_DIR}/ jenkinsIns tall_${TIM ESTAMP}.lo g" | |
13 | HOSTS=ci-s erver | |
14 | playbooks= ("install- jenkins.ym l") | |
15 | ||
16 | function u sage() { | |
17 | echo "us age: $scri ptname -e ENV" | |
18 | echo " where ENV = AWS_ DEV | MAG_ ALL | MAG_ CI | MAG_C IT | MAG_D EV | MAG_S QA | MAG_U AT | MAG_T EST | loca l" | |
19 | echo "op tional arg uments: " | |
20 | echo " -u|--user Bitbucket Username" | |
21 | echo " -p|--pass Bitbucket Password" | |
22 | echo " -l|--logfi le logfile " | |
23 | echo " -c|--nocol or (for no color)]" | |
24 | echo " -s|--skipr oles, not collecting roles fro m mccf BB repo " | |
25 | echo " -x|--extra vars, extr a vars for ansible s cript" | |
26 | echo " -v|--verbo sity, ansi ble verbos ity count 1-5" | |
27 | exit 1 | |
28 | } | |
29 | ||
30 | # ReadArgs reads the command l ine argume nts passed to it | |
31 | # and popu lates shel l variable s accordin gly | |
32 | ReadArgs() { | |
33 | LOGTXT " Entered Re adArg" | |
34 | while [[ $# -gt 0 ]] ; do | |
35 | key="$ 1" | |
36 | case $ key in | |
37 | -c | --nocolor ) | |
38 | UseColor= No | |
39 | CLEAR="" | |
40 | COL60="" | |
41 | NORMAL="" | |
42 | WHITE="" | |
43 | GREEN="" | |
44 | RED="" | |
45 | YELLOW="" | |
46 | BLUE="" | |
47 | shift # p ast argume nt | |
48 | LOGTXT "P rocessing without co lor" | |
49 | ;; | |
50 | -l | --logfile ) | |
51 | if [[ $# -ge 2 ]] ; then | |
52 | LOGFILE ="$2" | |
53 | else | |
54 | DEBUG " $1 argumen t requires another a rgument af ter it" | |
55 | LOGTXT "Error in $1 argumen t (no next argument provided)" | |
56 | exit 9 | |
57 | fi | |
58 | LOGTXT "U sing LogFi le $LOGFIL E instead" | |
59 | # DEBUG "Log outpu t redirect ed to $LOG FILE" | |
60 | shift # p ast argume nt | |
61 | shift # p ast logfil e entry | |
62 | ;; | |
63 | -u | --user ) | |
64 | if [[ $# -ge 2 ]] ; then | |
65 | USERNAM E="$2" | |
66 | else | |
67 | DEBUG " argument $ 1 requires another a rgument af ter it" | |
68 | LOGTXT "Error in $1 argumen t (no next argument provided)" | |
69 | exit 9 | |
70 | fi | |
71 | LOGTXT "U SERNAME: $ USERNAME " | |
72 | # DEBUG "USERNAME: $USERNAME " | |
73 | shift # p ast argume nt | |
74 | shift # p ast fqdn e ntry | |
75 | ;; | |
76 | -p | --pass ) | |
77 | if [[ $# -ge 2 ]] ; then | |
78 | PASSWD= "$2" | |
79 | else | |
80 | DEBUG " argument $ 1 requires another a rgument af ter it" | |
81 | LOGTXT "Error in $1 argumen t (no next argument provided)" | |
82 | exit 9 | |
83 | fi | |
84 | LOGTXT "U sing suppl ied passwo rd " | |
85 | # DEBUG "Using sup plied pass word $PASS WD " | |
86 | shift # p ast argume nt | |
87 | shift # p ast fqdn e ntry | |
88 | ;; | |
89 | -s | --skiprol es ) | |
90 | skiproles ="true" | |
91 | LOGTXT "s kiproles: $skiproles , not coll ecting rol es from mc cf BB repo s" | |
92 | DEBUG "sk iproles: $ skiproles, not colle cting role s from mcc f BB repos " | |
93 | shift # p ast argume nt | |
94 | ;; | |
95 | -e | --env ) | |
96 | if [[ $# -ge 2 ]] ; then | |
97 | ENV="$2 " | |
98 | else | |
99 | DEBUG " argument $ 1 requires another a rgument af ter it" | |
100 | LOGTXT "Error in $1 argumen t (no next argument provided)" | |
101 | exit 9 | |
102 | fi | |
103 | LOGTXT "E nvironment : $ENV" | |
104 | # DEBUG "Environme nt $ENV" | |
105 | shift # p ast argume nt | |
106 | shift # p ast fqdn e ntry | |
107 | ;; | |
108 | -x | --extrava rs ) | |
109 | if [[ $# -ge 2 ]] ; then | |
110 | XTRA="$ 2" | |
111 | else | |
112 | DEBUG " argument $ 1 requires another a rgument af ter it" | |
113 | LOGTXT "Error in $1 argumen t (no next argument provided)" | |
114 | exit 9 | |
115 | fi | |
116 | LOGTXT "e xtravars: $XTRA " | |
117 | # DEBUG "extravars : $XTRA " | |
118 | shift # p ast argume nt | |
119 | shift # p ast fqdn e ntry | |
120 | ;; | |
121 | -v | --verbosi ty ) | |
122 | if [[ $# -ge 2 ]] ; then | |
123 | count=$ 2 | |
124 | if [[ $ count -ge 5 ]] ; the n | |
125 | count =5 | |
126 | fi | |
127 | if [[ $ count -le 1 ]] ; the n | |
128 | count =1 | |
129 | fi | |
130 | vees=`p rintf 'v%. 0s' $(seq 1 $count)` | |
131 | ANSIBLE _VERBOSITY ="-${vees} " | |
132 | else | |
133 | DEBUG " argument $ 1 requires another a rgument af ter it" | |
134 | LOGTXT "Error in $1 argumen t (no next argument provided)" | |
135 | exit 9 | |
136 | fi | |
137 | LOGTXT "a nsible ver bosity is: $ANSIBLE_ VERBOSITY " | |
138 | DEBUG "an sible verb osity is: $ANSIBLE_V ERBOSITY " | |
139 | shift # p ast argume nt | |
140 | shift # p ast fqdn e ntry | |
141 | ;; | |
142 | -h | --help ) | |
143 | usage | |
144 | ;; | |
145 | * ) DEBUG "$1 is not a valid argu ment" | |
146 | LOGTXT "$ 1 is not a valid arg ument" | |
147 | exit 9 | |
148 | ;; | |
149 | esac | |
150 | done | |
151 | LOGTXT " Exited Rea dArgs" | |
152 | } | |
153 | ||
154 | #source th e commonfu nctions | |
155 | . "$script Base/commo nfunctions .sh" | |
156 | ||
157 | DEBUG "Che ck if log directory exists and if not, c reate it" | |
158 | if [[ ! -d ${LOG_DIR } ]]; then | |
159 | mkdir -Z ${LOG_DIR } | |
160 | fi | |
161 | ||
162 | ReadArgs $ * | |
163 | ||
164 | DEBUG "scr iptBase: $ {scriptBas e}" | |
165 | DEBUG "ROO T_DIR: ${R OOT_DIR}" | |
166 | DEBUG "log ging to: $ {LOGFILE}" | |
167 | DEBUG "vau lt pass pa th: ${VAUL TPASS_PATH }" | |
168 | ||
169 | DEBUG "Ver ify ENV wa s provided " | |
170 | if [[ -z " ${ENV}" ]] ; then | |
171 | DEBUG "E NV require d" | |
172 | usage | |
173 | else | |
174 | LOGTXT " operating on ENV ${E NV}" | |
175 | fi | |
176 | ||
177 | ansibleExt raVars="va r_hosts=${ HOSTS} ${X TRA}" | |
178 | ||
179 | if is_true "$skiprol es" ; then | |
180 | LOGTXT " skiproles specified, no need t o install roles" | |
181 | else | |
182 | LOGTXT " Install ro les from $ {REPO_FILE }" | |
183 | getMCCFR oles ${REP O_FILE} | |
184 | fi | |
185 | ||
186 | LOGTXT "St arting to process pl aybooks on ${HOSTS} for $ENV e nvironment with vars : ${ansibl eExtraVars }" | |
187 | ||
188 | for item i n "${playb ooks[@]}" | |
189 | do | |
190 | playBook =${item} | |
191 | LOGTXT " execute pl aybook ${p layBook} f or ${ENV} ${ansibleE xtraVars}" | |
192 | runAnsib lePlaybook ${playBoo k} | |
193 | rtnCode= $? | |
194 | DEBUG "r tnCode fro m running ansible pl aybook is ${rtnCode} " | |
195 | if [[ $r tnCode -eq 0 ]] | |
196 | then | |
197 | DEBUG "${playBoo k} complet ed success fully" | |
198 | LOGTXT "${playBo ok} comple ted succes sfully for ${ENV} on ${HOSTS}" | |
199 | else | |
200 | DEBUG "${playBoo k} failed: returned: ${rtnCode }" | |
201 | LOGTXT "${playBo ok} failed : returned : ${rtnCod e}" | |
202 | fi | |
203 | exit $rt nCode | |
204 | done | |
205 | ||
206 | if [[ "${E NV}" == "l ocal" ]] | |
207 | then | |
208 | DEBUG "A dmin User is is 'jen kins_admin '" | |
209 | DEBUG "P assword is 'Password 123!'" | |
210 | fi | |
211 | # CONTACT INFO | |
212 | CONTACT="L ee Benhart : PII or DNS . URL " | |
213 | ||
214 | exit |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.