From 277265da84daf09669547be8432320b063593c9c Mon Sep 17 00:00:00 2001 From: brianstinehart Date: Tue, 7 Nov 2023 22:47:26 +1100 Subject: [PATCH] independent wait step and SNow setup --- 1-bootstrap/group_vars/all/secrets.yml | 153 +++++++++--------- 1-bootstrap/group_vars/all/vars.yml | 4 +- 1-bootstrap/playbook.yml | 13 ++ .../pipelines/base/tasks/conduct-day1-ops.yml | 42 ++++- 4 files changed, 131 insertions(+), 81 deletions(-) diff --git a/1-bootstrap/group_vars/all/secrets.yml b/1-bootstrap/group_vars/all/secrets.yml index c67efbb..241ca68 100644 --- a/1-bootstrap/group_vars/all/secrets.yml +++ b/1-bootstrap/group_vars/all/secrets.yml @@ -1,77 +1,78 @@ $ANSIBLE_VAULT;1.1;AES256 -33663431376236303530633431396137653563663937303231656632393762353561343337303034 -6263666632633839646466343934376462663831353562640a653931613336373139653963326163 -30363666346639303762626461616236643236623263376532346561383862326336616431343631 -3432316630383966330a343233313235303165623537616239643161646562663363653236386438 -66393338613964653534653962666639666337306139336532323061666663376464373362326333 -37643430613061353038363761353739376534663533663133333332333036613466346438346433 -35383865313434643336393062633965326461333666376632636665373064343839643035303636 -36633537363438393134313562653164613737663664396162613337623630613731313762303537 -31313730336665646131386137306464656365633630303938343438383238633639316666346263 -65353061353635316466643463646630653163396239353830383639656536626135316362303936 -66613861396265316338663135353436663531653862346333346665623930323161366666303762 -33303936643132633164353032393233303938316636623037333134303565333361383736656432 -65626431353865393030316465356334383436313333656535643865646565653462633666616466 -31306161383130343163623534633962396536663032373137313730326537643838656538326563 -66356361633231376338653364373136393833303536306438326532396338653736323237313765 -35613936626365383438306236323539653261643737333334626537653164643533323966626436 -62613231613764326265646664356537626165646335326165633035393235376566316566663365 -39613530656333623461643063666436663637643739646663353034616631396236616632303466 -36613236613832653266666332616335333530343238663061343636653661393934336235343933 -39373066656438363431313433373534613263373665396566373939336537313534386231386335 -38663939333637353234346231343537613535366664393638356665346430346236386637343931 -64373532663561303837353637616562333439353965313264376633333536343935373433343833 -38333037313563643731613834613362623761653564383036393736343036616633353966653663 -37306238356165353330383635353065313065383338323862643963636530353330313731333865 -31353436376665393165616164303938366662633935313261386639323930623336333730346338 -38356533373865313235303164613136376330306431316432306236613766313764366461623632 -37626432366335663635356161343337393361343534656661393265353735313566623064326666 -65363834336561366232643235633766623739366333376464386664326439343266303832346438 -32643336656262333961623732653335333864383439643063663931663333333233306664313534 -31363031613030343264343536626430306264366537376664656464623764623861633539336139 -34393262653933303061633162303938363766393033626330383030306535303662393239306531 -61626233636631353165393639383062646466393234396233336432383738356266613061383335 -38366538643766626637323330333566353165656638396562303931386132353062336539343262 -38323863333764393438323235623130653066356562313031636365373234393863656331646162 -62303733323966666438343934303663346333626231326538623736653433343963626334663561 -38393966663038653230373136393736666236343235613266623033393033303766356361636165 -63613037656366383133303464363936336463363037346231643838373932613336313866386462 -36303637646330316634643238613331386435316136643036303435656566316663663336353034 -38343834323934323461643464346664306431373766613064666639363962653563386265613830 -39336431366631376130303365343238373631306134616462396166363237643937376563346237 -36353837623230373638613061636533393138393566333530323266366539363837646533626538 -39346564376238393034316161636334333830383766316264353533393632663637306234636565 -35303538656261303664643430363665326534626339393437346538366162313365643837613564 -35373637643435326661623030323336376134663163306266303035386564623436393530386335 -38623131356237396266623031616433313930646334633331616138666337326632313332323264 -39336637313430643933343238356262373638316338386330363938333531613066303035633035 -63643066376561393739333635353130306337643930376438306463313731613339373463633236 -34356436343831346130373935343762346563383030663233383862336136623364663739343636 -62376235666264616364663338663437623035386235333239393164303665623136346631383738 -31313534663932653232646562386639653132626164386436373361373665356336313736643761 -37383835313834323761323437313434613334396430653438313031306431363837306130633330 -36303563356630386539613738313039393535373335323233313562633764363966623961613730 -39363037303733313136353463643465613866343732383633643263306538363564613566356434 -38363634633735363338323033373037626434623935363562396263646538346239363532633938 -39613261613732336562306132636434323833656332613962666639313564613535333634396235 -32643531393261383533653636313331633238383161383565613238396334366462323334343534 -39653061616661323833316239313333313638373436393463666531613935663238326235386430 -65393233313335346137306234356430616333643664393535636237393461373830313232323564 -35316266623039373561636536336335373731313332616564366332313862616630303635393536 -36386636363366326233633634626538646535626534346664343966363637666231666536303633 -63346566393666313836373237626563626235636361323863373466623731343261393165326435 -36663533326337343033663332623631343066356334643232643662353839393035623963336538 -32653264366163326662646464623931316433376334613063303531396161613362303166386665 -31313563366538356163353839643838363665323636666635326361336538333064383035313434 -39616465616530313366613633613433363565353539383361336139323932333337303936626239 -39623064333930343062633065633662336130623965633661353161323437626230306232613337 -65356364353866396333653034616539663566343630313730343730326234636337396634663661 -63383261383163303063633666663263323139313434353665643363383933646138646430383330 -30386238343963616434653633343830316533396466386239646230373431396163313036343565 -64633764353832396432343266323664363763346663646565666132623133306361306534336530 -36316165303433313034653835623532663464343638613861393561353735333766333835656330 -30303663613761323762636138616433613431666230326562613063323938303435396533613864 -36643061373330313765363463326134303634653737333930633565363738633734323232656362 -33646234373637373530396363653164333532356463656266623032383332366239626565373664 -35313064363364363336333030323931386130323562636430346634333761323862323938336134 -65656262336434626238 +62616165313134343964393763623464633234316561373730633836626366373064653063313134 +6164663733393338663533616361356233383064336435390a626664353864316564356332656165 +62626138653264646361656131623238653236333837356163353433373232343535383831636439 +6163666538356134390a353334303130616633643337346133363936633462353537363239323137 +30653935363064393833646461373164313666616439363064393434366339653565633137306461 +30376333393430666431663966396232656162303362346366346436653062393838346364643233 +62623136393532383336396363613730303966333165333033316635343736646533623238336162 +36663062666631656433383736373264636432613761383364643033376533343933383563393163 +35306132376632613933653432613137663265353965636565316462383833396562613662343234 +62346130383032316136303331313038636464613134633737303066333565643962666566373766 +31646131396436623530313537623233643430386333633961333734393730663062336630656463 +62313638316466396332353465636263383962623833646466653962343035633762636133323264 +63346165376335333939323939306661313936353264313133373337376361646563663730333833 +38643066323631666630643433663236326330386135313239393633623538643866663935343637 +30613233353665333033346536306433313932613935303435623562343961333466386364306132 +34346135356463626262333733343036623336373538336538353031646237306334663434326339 +31346435353765373762356663643039633633643438636430383464313237323438663331663339 +31336632316662383836353032646366653335623937643333626266646664303437623339646132 +34613638633436353166363865316439386436313530623534343638373735346439373436393265 +32363436663465633664353432656233333730653033363565356136396531663035353939366165 +32376361643136356630366439313466343138383039306661396138343631313531306437663632 +37376135343164613036346338313638376538613936323361316331333539326234396336303365 +62656362633735613164376133636531343532653062316433626334636333363036623961396530 +63383735323465343462343038346236653935373531656262653135383732356562313735313165 +35666232643062373666613664346437633839393663656564386565343362643464306535396434 +36653331656231303965303434633334316430346631356662316463306363646261646637633933 +31323638633531356534643336306334613737613037646139663634643864336234636166396538 +39633636316435343832636361343538636465626438373432373939333038666562363938313138 +64313733313339663938316438356638376438303637316139616130303931326233323739323933 +64303066353139303732316632666338383636643664653266316534343462353062333939653463 +30613835303231666634653834323834633033663331323062663233366332623033343666313166 +31653330643966633063636631383562656564656134343932653434356666306536366164376532 +32313931393239343938353765366538623066323462626433616434396130623438623531353434 +34353430633136623737346138653130353331653830363365613135626565656263333434663063 +65646231393265633336343836363036376664656561386438653539323364376462636439393739 +62663164646638393262353763313532623835386333633633363166653839396632306533643434 +30363431623632303833633933636336626430396238306339613135383663396266333332323162 +65643039356633366663653637396632666333666636343264633262353032633330643734383339 +31363331346533356630373830666665313535366534313062303565363831623838396537303835 +66346538333735643532653262313036646361326334623333396464663966396666373236323131 +66303564396365663438393336323538363465356434623534343630613862376165343062336534 +65343661336138333363326164303533613933633230656638656132383364613137646235383463 +39366165353632396439383732613261346333626239643865623038633834316436313932353533 +66353635663333633634666437316536303764633432636261383163626664346533366232356139 +64393535326638316338653864303365313566313536306235323039386361633864613566653935 +33633831396366643861613930633233363364666533343932303966656439646262363132336638 +34666563393561386537313632313732353634643162383466666339336437323165393861376661 +62363836643866663037316139303063393333373437353463613636656263393066306239303261 +30303364303864643366353065323566383230383335343135333665356364623234613132653462 +30656235366661333130643833316236353237336263313962383463663063333631376436633161 +31623266613766336238323330366630393138663061656334383136373237646261356134306230 +36373161326564396636616535653034393831633036663136623663393937366231373663396438 +62313239323166346665636538303766326666613530313339653964666138656132313762386331 +61613833656331376639303863393265336261633435643636323736333937376437373465376237 +39363766613730663065616464613433643636646332383038343331373538346532326364656462 +37363333366661666331376130613039313939363066643963336436633861313133653838666439 +33313333383163643961613137646239303435616236633838393534393265326436663664373263 +66333338323339613362396134383139313332666334613565376165623737343766363930633831 +30366339363332623333346264643434366438343266356239366436383265316534343263656635 +64616133666666396638613265633434323665653734613931316631343463663336616233626335 +38326434303838336238313039613830613931353966633434396666633834623034353630663337 +64363938366263386663333339663461613034353937336435356666316561376562336233343966 +36616131396337646633313234363864353564356533616465303935303830633730303364373331 +62663462613237363565346161373364613264376264333335636139653362656436663965333365 +38386364336637613134643562613233373739333039666461326263646461623930663530636638 +31393135363064393762313765353366376238636261613034653362303139303238663264326633 +63643066303638663137333235623561653161393566323963343036393632626130393365383932 +61366635633733373837323737366435306238656566663432343337396632306236386432323666 +38623966313630653630336231356365643462363934303537633666663339353332643736643134 +36313934353130663236393663316266373132396663343833633335333036643838623736633637 +38333135343835646462383130643837393530633765373836333337306262386233396664636137 +65656365643765633039656138383538623165323235373837353364373130303438613631613836 +31646230383930373932616237626537303733393733393862356361316231366630303636333731 +31363036323536336333353637656466666664616262363538343164616538343032343936643037 +37396434346531366166306433373562373238333366306338633163373436613138653631613432 +36613536303164393265323461636561633766356135346131353437353231383666363766396334 +6362 diff --git a/1-bootstrap/group_vars/all/vars.yml b/1-bootstrap/group_vars/all/vars.yml index 51cea9d..6d60644 100644 --- a/1-bootstrap/group_vars/all/vars.yml +++ b/1-bootstrap/group_vars/all/vars.yml @@ -1,3 +1,5 @@ sso_oidc_key: servicenow-demo-rh sso_oidc_endpoint: https://sso.bastion.blueguardian.co/realms/aap-as-a-service -sso_oidc_verify_ssl: "true" \ No newline at end of file +sso_oidc_verify_ssl: "true" +snow_user: admin +snow_instance: https://demoallwf33029.service-now.com \ No newline at end of file diff --git a/1-bootstrap/playbook.yml b/1-bootstrap/playbook.yml index bbd0287..5015cad 100644 --- a/1-bootstrap/playbook.yml +++ b/1-bootstrap/playbook.yml @@ -116,6 +116,19 @@ endpoint: "{{ sso_oidc_endpoint | b64encode }}" verify-ssl: "{{ sso_oidc_verify_ssl | b64encode }}" + - name: configure ServiceNow secret + kubernetes.core.k8s: + resource_definition: + kind: Secret + apiVersion: v1 + metadata: + name: servicenow + namespace: aap-as-a-service + data: + user: "{{ snow_user | b64encode }}" + secret: "{{ snow_password | b64encode }}" + instance: "{{ snow_instance | b64encode }}" + # This namespace is later managed by GitOps, but is required for the initial bootstrapping to complete - name: configure cert-manager project kubernetes.core.k8s: diff --git a/2-operators/pipelines/base/tasks/conduct-day1-ops.yml b/2-operators/pipelines/base/tasks/conduct-day1-ops.yml index 63503fe..d6100d2 100644 --- a/2-operators/pipelines/base/tasks/conduct-day1-ops.yml +++ b/2-operators/pipelines/base/tasks/conduct-day1-ops.yml @@ -51,6 +51,27 @@ spec: name: appUrl type: string steps: + # Wait if instance is not defined + - name: aap-build-wait + image: >- + registry.redhat.io/devspaces/udi-rhel8:latest + resources: {} + script: | + #!/usr/bin/env bash + set -euxo pipefail + + export INSTANCE_ALREADY_DEFINED=$(params.isAlreadyDefined) + + if [[ ${INSTANCE_ALREADY_DEFINED} == "true" ]]; then + echo "AAP instance already defined. Skipping step." + exit 0 + fi + + echo "Waiting for 60 seconds for AAP Controller to be up" + sleep 60 + + exit 0 + # Update appropriate variables for the AAP instance - name: upload-manifest-to-aap image: >- @@ -62,9 +83,6 @@ spec: export INSTANCE_ALREADY_DEFINED=$(params.isAlreadyDefined) - echo "Waiting for 30 seconds for AAP Controller to be up" - sleep 30 - # if [[ ${INSTANCE_ALREADY_DEFINED} == "true" ]]; then # echo "AAP instance already defined. Skipping step." # exit 0 @@ -367,6 +385,22 @@ spec: image: >- registry.redhat.io/devspaces/udi-rhel8:latest resources: {} + env: + - name: SNOW_USER + valueFrom: + secretKeyRef: + name: servicenow + key: user + - name: SNOW_PASSWORD + valueFrom: + secretKeyRef: + name: servicenow + key: secret + - name: SNOW_INSTANCE + valueFrom: + secretKeyRef: + name: servicenow + key: instance script: | #!/usr/bin/env bash set -euxo pipefail @@ -404,7 +438,7 @@ spec: \"project\": \"16\", \"playbook\": \"setup_demo.yml\", \"credentials\": \"4\", - \"extra_vars\": \"ansible_python_interpreter: /usr/bin/python3\ndemo: brian_custom\nusername: admin\" + \"extra_vars\": \"ansible_python_interpreter: /usr/bin/python3\ndemo: brian_custom\nusername: ${SNOW_USER}\npassword: ${SNOW_PASSWORD}\ninstance: ${SNOW_INSTANCE}" }" \ https://${TEAM_NAME}-controller-${INSTANCE_ID}.${APP_URL}/api/v2/job_templates/