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

Jenkins #579

Merged
merged 12 commits into from
May 27, 2022
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
2 changes: 0 additions & 2 deletions galaxy-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ roles:
version: 2.0.1
- src: geerlingguy.postgresql
version: 3.1.1
- src: geerlingguy.jenkins
version: 4.3.0
collections:
- name: community.general
version: '>=3.0.2'
Expand Down
4 changes: 2 additions & 2 deletions group_vars/jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extra_jumphosts_for_jenkins_server:
- 'tunnel' # Nibbler
- 'porch' # Wingedhelix
ssh_host_signer_hostnames: "{{ ansible_fqdn }},{{ ansible_hostname }}\
{% for jumphost_for_this_cluster in groups['jumphost'] %}\
{% for jumphost_for_this_cluster in groups['jumphost'] | default([]) %}\
,{{ jumphost_for_this_cluster }}+{{ ansible_hostname }}\
{% endfor %}\
{% for extra_jumphost in extra_jumphosts_for_jenkins_server %}\
{% for extra_jumphost in extra_jumphosts_for_jenkins_server | default([]) %}\
,{{ extra_jumphost }}+{{ ansible_hostname }}\
{% endfor %}"
...
143 changes: 74 additions & 69 deletions group_vars/jenkins_server/secrets.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,75 @@
$ANSIBLE_VAULT;1.2;AES256;jenkins_server
39653431386530663162643638633739383935336537386431353139616135613961633731613636
3334383039333434383438376164343733616337363331640a313338323461633436613766353836
34646537383932306534346234343264313836653938613537376235666662363837393833633463
6238343938646164620a633936303632333761643737663936653937366636613533306264303532
37376664623665346165646534313634623135333133356566393737653330353035303034373930
36363064353739643738663038646635363239303639633835333036653735623866303330393933
35636633353837663139663833373731633961356665316565356666356665643639336638663837
63303863313233663234643534373431653638336665613032633036616134353837363363336631
30313133326539303534633866353032303965626236613033653564643539336236613662336535
64626261653363346366366534313139663633336639646562306331653538313130653463303663
35386264396361623137313333343133383938323837623538373532656234386238613431306538
63636130616632633062356630323366623736653039373938636362646437643032363030393634
39336362656432376437383532643834616234666637316161363163373436363063626263306434
38363162636262323331316333393734373230373934363334353536663862386432373864336261
66303935393163383766393037376639643461323033316466616336636264643539373835396439
34323763353130396232363934313636653035383965636235376464333139336135393065663030
65613131363734363733313636393135383032663037333164613237643038316135343762626161
63646563303737363239653261386433633062623965373130646665663732656539313462333834
39343266353465333633343166313333643932333733316661636238643366303537616165306663
35373965396464343437356531303236636531393234323464373034353031333664306364343561
35653262356233623635666363343162613635666363663462626665316235353665633936326138
30383432633536303831323461396563363133356533393533363332393361346438613261636238
62313736663735653036323338316531373666353665666364656539613739323235373863336536
32386266336563653339383065626539636566323234313033316261353365303236653031393263
61663464613237643939663836356661353164366162323865396635366262323538656334323663
37366164333038386130363734663931363934626538383963656163646236323934386639396465
65386162313731366661633330303438303863383231373864316263356535383966336366386662
38636534366264666234323937356464326561393261663031643137633936626263666566373564
33656437623939356663393166653936346563383830636463626436663464633366363332383861
34366439393265313633336639343531333533383635626533336230306237643364383231366364
34396263356230333063636536363234646632383334663361333031356634306163313430623138
38346237343966646566363462396237663335666430373566303937636163636435643864613235
36376263343331646631633764313237653463376239356365346664663239613838346162616231
65373339333363353330306161613534666433636236623231313936353837363161653063323938
32366463623834306665323337656135303466323332383636393861373761366463366534343166
31383834633465386335356464303435623434633561363432636331383763383633326466373566
63326235323039353734346631393064643637353132653132373239656264616331386234363631
32623336666238373134376137366231363061363362333465353730343330363963666434616633
39616230623864356561613838613132613863393737313165323861313865356535393064323965
65643065333461663136346465643730363663326665643437356563383839356461623236326330
64353061306161323263633835343038323334633039623837666536613738626264323934653536
61383434656436336363363066373532356463396163663538643732313961363034393034656263
66373064623936356263656464366233323936333635653563303133333331613533623163626432
32653365653565623537666536306530653263316635333731336539363063626531653966656666
63343036313062666535316562356665646365343934363064336332313863613134353937373265
38353539313836643330343330306131653933316432346537623961343336646639643738663738
65623334643930346361396233356565373633326531363234636630646630653737643039623432
66336662636664376663366630376666373064306530646265386364353338663435336161646261
65303736373734366533333134653563663131653830393962643838613136326539386535666235
62303035323865323061666632326465653032366231353930336538663437326237326634376665
61333831633236653261653966346239613232653138653335383732386437623163363264336665
36316534666231336438383663383834396164663034366637653165383338613562363764666336
37333735666137663532303134323363313663333063663562343461326234366439303738383936
39306632383164613563623263643531653935616333636139303561363464636530333439663731
30393764636238306439616162353766303232333139363261623037313631316662626335376665
62623233336563353932356433626430363232393039383861396266633662343933653665663534
38323431313335643963363834373634636266373737653966613265326134616564383734373435
64343035363633356163633166653932663531343934343230346133633333326331633032653039
61373830613964636138386635636264396530646633633263646664613531323861613936613565
38373230613333383338373533313866666438636436633035306138633637313839343836353538
65316361666236306364343436366634616430626437363063653034376666313631616133653663
62363464306234633963646233306434623061326161326339666538353830633765656262313066
30653539643033343637393131376433363765663731316136613333326565656162333337363937
36616535333237346561643236636563323233643066313830646466303764393364633066666536
35643834383062326264663161613039633861333834323539663530653534633437313038373732
33383064633337346130303139623436616166623834346530333965623266666463313163666262
35393130326339623935616337373438636231353664336164323531646436383564393765366666
31616433643363626232386634313038353730633631356136636563373135306365646533333462
33303335323032646663323830666133653862383663343965363834393335336633
64366233383938383637656534643462303464306265663637383066363266323336396633346535
6262306630366130333735633236343030353533363862620a316334653661656136373663356338
38613965383663646633656636303035333464653762623963623462326165386139393035346262
3164663136643734620a393861303530373937366537613263373762646434386433643862613334
34366631333536363765363631633337343130306436636231653164386565326234323964393334
33623031633535306465383564316563643763333235373538313062363365373730383865653564
62633837333631316139626536376562643130626134366338386630356336353633336632306434
33366631626630363438656237336330376163323661386664636130373366373463353636373562
32666565306535663761636333323335313635343462653762613261636630656534393232366633
37323931656630616262313066633965373663306532323732306664663430326539643637663538
33356263326366633761326239363230326536633164326263633630313961353139616366646462
66623233643666333865643463613264376338633665333935346530653939666262333734346338
66316564336564663063383166623063376562623139396131363037663363386661643064386131
33323231623761646131643331333562376439323130343332646430656535393331396430323936
64626561653666346566346532333838646239646332356133373930316433386464366632626235
33633637386631363062353262613863366165316333663763343932373066643733633833356537
39396538646135323539323139383730646363613638343234336662363731383730303962653733
37613934356338336631653130326137346237316263303566313131356262313339363561316537
34333836313137323431656566623833613463373565393566323063393435613336663136323832
32306131336462333431343231636162336365363433363238616238336162626635656132386538
37633036373531636434616263373432303036386264663864303661666434373832643234663238
38626366373763373663653432313335633534323733356435636466653634646230343730623263
33323962306164653538653231366135316463323462333661626439623030383932353430613438
33316138656532643036303861613365633765346161336434356162623135316161386165623233
36633366366239616630383033353630633339356338303033643835363136366134363464616534
33653035616136353539663630333566656335316539646139626135373039383833393237623534
62386334306666363861656633356366373735363030636330373966653633303063346639316565
34663832633835626430303833366463313137393265656430343233636230373037643162633865
65313735386634363433363564626639363939363039386562636435623561326664633565333238
31343733643035636339383461626435663765306135663839643833396361333238313937396461
31323062326466393438653164666565333235313162636236633739326232653735306162313561
35353536633365613030353339396132303564353433303164313637383363333261333234366433
61363131356363666632363632633761323935636361363431363034613830626338353239333361
66666363326130623337376133616331373663393766303433353762636666373037653539613135
36376434616432366163393931306261623937383332633735303439623934373630383263386663
65363038626362666235373365336631303763356433353633656335313766383037323034373534
34343362333038646139623839643332333434623731326637653635363661313833623633353764
63336539366535663135626266336333373838346439316631373163643131353265613962613436
64356333326361303862303530616366346663393032343461653033633036323863656234366562
32363563363530356131306234326630333331343235666265366464646262646165663963303336
62303837613638646239363739376539653230313734666232656165653361376238616631666338
31383438313537643336653462616132383530646238353238633634356532323933343636343166
31333933343934306630653436383763386139323361656438636239336433323966646535386332
66393032613565653238613065363732393562396564343331366164326534356231623337346463
31373736326662303036326332326331383038356434383831636636616236326130386164373265
65336635333039633733323739333833356430303662663034316161333562336565633032346664
35623066623730306662383861356132386263323032353539653166303834666532323635383331
39346535623839326261303964376436373163643864666339633462393034393561363134333365
37653365323766633736306563613437353362653033643665316630666564306565343465363632
34323361333333626364376132633936656430613865643036623532336666653138383633306239
62386332643036333362643866613764396362303335383431663037653666636432373038653638
37616261386339313863396664373838333338613338643663323464336530373663346134636231
35356664393335356634643434623139663966363132326236313562653061643164306164383239
66333135626161653537363439303264393230646136623261636139356463623131306630393238
38633662323232356137663161653663633037626664353264616261653464623661646561353039
39646465353533643731313933333561653337666264333166366338643362633733383161373739
38326539636132626330323936303234303637373535376166633263313337373038313536626464
30346539323533646335623939386536656431316364353333653232376438373362386236303932
64633238353431383163333738346133366461373162356131303931386464653763373364386664
31383933643231396232663064646361303731353032633130343338666264383362363737626639
38333339306662333064666436396364386337613939623262663561646637636634613761333966
62323564386165623731303063343637393364383465643135363863656232636339386434643461
33366630646461636464383339333630346231306434383461636431313238393766393263343539
63396165366364343032353831376430613531303739306135656537383338366165383638623765
62346665626638383261613931336439376666363536386361633063303836626165636665323332
31616364623163353334316637303039376535333566313738613563333461383638616135303064
66666566363937323162323662373762613431336333323031333562356239323366323562646262
61383161636237366565343339363164623666333139663132323261306162613865326532623635
36323430643663326638623662306334353433376433653661356537366430663566346233663766
38366161346461383261373161373735336664313965323537633463303565376337306337653061
33383533636637623265623864653363616238343933353239333039633932353330316334303730
63663431626235393133383934316436333437363830393636653231376164613535353334633537
62636136333131613233636534336632663764623566613233653966663763373935386634356231
3462336364393464383661633731383139386566373137353732
5 changes: 5 additions & 0 deletions group_vars/jenkins_server/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ jumphosts:
- 'corridor' # Fender
- 'tunnel' # Nibbler
- 'porch' # Wingedhelix
jenkins_plugins:
- warnings-ng
jenkins_plugins_install_dependencies: true
jenkins_prefer_lts: true
jenkins_shellcheck_version: 0.8.0
...
1 change: 1 addition & 0 deletions inventory_plugins/yaml_with_jumphost.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def _populate_host_vars(self, hosts, variables, group=None, port=None):
self.inventory.set_variable(host, k, variables[k])
if ('AI_PROXY' in os.environ and
os.getenv('AI_PROXY') is not None and
os.getenv('AI_PROXY') != '' and
os.getenv('AI_PROXY') != host):
self.inventory.set_variable(host, 'ansible_host', os.getenv('AI_PROXY') + '+' + host)

8 changes: 6 additions & 2 deletions lor-init
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ function lor-config() {
# Init and report current setup.
#
cd "${LOR_DIR}"
export AI_PROXY="${_jumphost}"
if [[ -n "${_jumphost:-}" ]]; then
export AI_PROXY="${_jumphost}"
else
unset AI_PROXY
fi
export ANSIBLE_INVENTORY="static_inventories/${_stack_name}.yml"
export ANSIBLE_VAULT_IDENTITY_LIST="all@.vault/vault_pass.txt.all, ${_stack_name}@.vault/vault_pass.txt.${_stack_name}"
printf 'INFO: Current working directory is: %s\n' "$(pwd)"
printf 'INFO: Using AI_PROXY: %s\n' "${AI_PROXY}"
printf 'INFO: Using ANSIBLE_INVENTORY: %s\n' "${ANSIBLE_INVENTORY}"
printf 'INFO: Using AI_PROXY: %s\n' "${AI_PROXY:-None: no jumphost specified in ANSIBLE_INVENTORY}"
printf 'INFO: Using ANSIBLE_VAULT_IDENTITY_LIST: %s\n' "${ANSIBLE_VAULT_IDENTITY_LIST}"
#
# Enable ansible_mitogen strategy plugin for improved speed of plays when available.
Expand Down
33 changes: 33 additions & 0 deletions roles/jenkins/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
jenkins_prefer_lts: true
jenkins_repo_url: https://pkg.jenkins.io/redhat{{ '-stable' if (jenkins_prefer_lts | bool) else '' }}/jenkins.repo
jenkins_repo_key_url: https://pkg.jenkins.io/redhat{{ '-stable' if (jenkins_prefer_lts | bool) else '' }}/jenkins.io.key
jenkins_pkg_url: https://pkg.jenkins.io/redhat
jenkins_package_state: present # Change to `latest` to update Jenkins if a newer release is available.
jenkins_connection_delay: 5
jenkins_connection_retries: 60
jenkins_home: /var/lib/jenkins
jenkins_hostname: localhost
jenkins_http_port: 8080
jenkins_http_listen_address: 127.0.0.1
jenkins_jar_location: /opt/jenkins-cli.jar
jenkins_url_prefix: ''
jenkins_java_options: "-Djenkins.install.runSetupWizard=false"
#
# Plugin list can use the plugin name or optionally a name + version dict.
#
jenkins_plugins: []
# - warnings-ng
# - name: warnings-ng
# version: "9.12.0"
jenkins_plugins_state: latest
jenkins_plugin_updates_expiration: 86400
jenkins_plugin_timeout: 30
jenkins_plugins_install_dependencies: true
jenkins_updates_url: https://updates.jenkins.io
#jenkins_admin_username: admin
#jenkins_admin_password: admin
jenkins_admin_password_file: ''
jenkins_process_user: jenkins
jenkins_process_group: "{{ jenkins_process_user }}"
...
31 changes: 31 additions & 0 deletions roles/jenkins/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
#
# Important: maintain correct handler order.
# Handlers are executed in the order in which they are defined
# and not in the order in which they are listed in a "notify: handler_name" statement!
#
- name: Restart httpd service.
ansible.builtin.systemd:
name: httpd
state: restarted
daemon_reload: true
become: true
listen: restart_httpd

- name: Configure Jenkins users.
ansible.builtin.template:
src: basic-security.groovy.j2
dest: "{{ jenkins_home }}/init.groovy.d/basic-security.groovy"
owner: "{{ jenkins_process_user }}"
group: "{{ jenkins_process_group }}"
mode: 0775
register: configure_jenkins_users

- name: Restart jenkins service.
ansible.builtin.systemd:
name: jenkins
state: restarted
daemon_reload: true
become: true
listen: restart_jenkins
...
Loading