diff --git a/inventory/group_vars/all b/inventory/group_vars/all index 51908a7..064327c 100644 --- a/inventory/group_vars/all +++ b/inventory/group_vars/all @@ -1,87 +1,102 @@ -$ANSIBLE_VAULT;1.1;AES256 -61636339313563393534663536346135646532613534636331373235326633396363313734383061 -3661636439343137336139383639663434343436306361300a303238376537643735323031313239 -34393965326336313935666566323934613134353564346632343832616336306432633332333734 -3938393330633364370a333166636266343561633666343335643262333364356332326661393035 -63396638643337633733616635383538633238666238333265363137616161303765306334663634 -31616564313136626238663539663033383263313334353531333163313462303763316165643933 -36666137663735353631643437396635633938313230373230626464313830383430326539323063 -39363863393631356530646338306462376166636436306334383566626465363535653837303664 -38383163666334316232336439326131616161663231316137396365383536343730333637306335 -62303832323466303839613833343866653134393734316434336330386136353237633332383262 -37663937643837336265376266623465376631646266623762616537386531633930356665643565 -65346232376632633438346339356663663236393263383739396632613866303663633033333839 -38336361393330343538666336383935366538383162333766343235306565663161653666393139 -35343337653835623863356239373961356562396530336235363337303636663339303931663665 -66383566663961323439316434306238303733363830323364616262626131613663356266653261 -37383037646638396630393538343033613730383035663533616133353832343965383539383136 -30616638373961343832653534653934323365636564663238373139303431643439343234646261 -65383938333533393536333733303163356266353631366130656365336465343039646330633233 -38333961353362326265393135373839643562376132656530333465373761396664623136646239 -37326265653064316534323534363631333666646134353430376534626331356263306532366331 -33613961303233626466353563653133613633383334663233336539393732353430333263326464 -39636631303865353639353138306166353934663366623066663630316233613264366432613838 -32643234373134306365643464663566623136663238333731343863643731643834666366613537 -30323334616138623232366433653836336331396464323133616334613635343136333735343837 -31363835383535343066363461373764633533626433323737393566623130323636333630633962 -64346465316631363330313862346663643166626464623566376262633664353138653966303661 -32363265653565636362336637396634383038363338346138353236633363346464643030643434 -34363435323766356661656333303862383164353739643833396265356263323831343261646431 -30333231623862626134363530386238623066306639636266386633323830356664666531396236 -35623362306634346638346639323135393266613536356466396563623162323730396234316630 -31303261626333376362353665316639313435333637326338656236623438633335363235646431 -64643933313139383131323666336130373538376531633065336534616533323132643664383862 -63313036616461626133623438336633366461616233633065653133633138366231366235643863 -33623239386366353334626634346562363738656139646136363437313632393930366363313636 -36643562303732366531613234313732633164616263646238396364646534613563646334643539 -36303836363938353230623662303133383132383931313564333438313839356130316336653936 -32336637663737643361656339313366333164363431643765343861353832396462386234353333 -61666130643334633765346561336339313832333732363738383731636361373037333866343761 -34616261366539353632663762326233633732343866663063643161363765323638633630643261 -34643061363361396130623731386338356234613862643966363938653166623565653235323563 -66363734333231336338363937306139313939616334656439376339336665336338306466633966 -38333736326533303631623137623933623336393334623134353135646366316438386338623738 -62396534646130326237353835313661353530663833653936353639353134663939636432363539 -31373832343362393032323738336336663439393835383562343831393963396661646566346566 -32656233633535306465303832303833383338646634383565343466343932666236623639616433 -34663935623064323339363864323365653733323534666334623533326166393237396561653038 -34343835376261643534306261353466643330323566613230396631346437366463306565363338 -31383033636631653738323832313631363962303535346361303136333063343036343835353834 -34366531383938383334333730306331386533336337326230346132336536323034623964613538 -37636331303135306365396466383336343334373239656339366663636134626363393234373938 -30383835376566303931313864346331383331376665633638643764383033633535656334303863 -36316563646562303864663665383636313164326664643235373464323635666434396632363832 -35386263613233626439393734393034663937336139343431636434396236386130303264343765 -35303839613036393262613130316439623637393166623030326233643139636332636237316236 -37383562326663336636623561393734386233396662646666323164363439303461383965613838 -33663639333236386266633836323131653035353036623064343134666133636364323132333731 -33363639393064646363333162636139306630376161383332326634346635376530643262313735 -34363336303032656161613262636666356165383064353832633762383939376634303136376138 -34313536633937633238346362303938643265616135363539346530663733643930646535393136 -61303661393066316436663363616166623232663337393838356565663938663336373864303130 -39663332353136366238316365333332653366643534366634373265643838306261393163353062 -62396632613564393139616130636334633130396366343533336339313731336433356436326530 -31313338643565626639393634343035643064633237383639356431343463346661343632326462 -64373361306630353761633535643933373939616536663964616338343465306639613037353365 -34313631373037656462376663323533633735313063633433613532653565653630643935353462 -63343337303134663532346163303138653136383965663162383337646563633834633736323361 -35656639326363653533336462393066333563386133663837383163616239346564393032396436 -38613464306330313437666563313837653335623731376164316261333430373533393430663663 -63363030333036646136663332616536356663363962336664653830383737376331646430646531 -63653736616364643164343338623030366364663766326163316439663734363963353064333230 -35653738346533363032316361363965346161336238363438626630666162356166346237316166 -31666161623330356162353865666532346538326165663939326662333562613665316666636262 -38373837373864333931383036633930616165333534323039626665643666353233313236663863 -33623331656135633238633261666364633361663934616139613261316363393633656465356330 -38646262363563643632386664393030373233653261383834353064633233663033636666653233 -31663932363362306663373535383234626131646666326465316138616438383239336163363362 -34623361313835663739343139373864643438333565313634393063366464336265303462383135 -32363632633930643866646262343163393136353562643439646462633135373838323035633965 -32663561333036643763323461653133393266646463326665373362383836633130326665623330 -35346363346166326366353236376465326666336330646238363161386363613765646338303663 -61316637363136306633633563306339613032353365636264313865656563396437373930323363 -63386238363839656635643638343235656166353539383363313766663132613161636361613566 -63666366346666623361376266346138363361323932333362356566306131333139373531623730 -34343532376434383932353465356261366239313939323138636231626131643061613365346465 -33303038656636656132653130653662643537653138353634336361666537363537313837353666 -3832343333643939393831336430323935323735346135633339 +--- +# buildbot-workers are planned to be accessed from the buildbot-role +# aswell from the worker-role independently +# TODO: Build it so, that hostvars of buildbot-worker machines can be mostly omitted + +buildbot_master_worker: + # The masterworker is a meta worker which basically does start other + # builds only. Additionally, It ensures that only one build runs at a time + name: masterworker + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 37666438333562303961356630313234663133393839356565303431623039353265373138313435 + 3333323936663462646339366665316130373561303830300a633266333231303363363066336361 + 39633730666231363430653034373531313130353637633765363962356534616239356461646439 + 6336353265636336320a323539353765386366346463396361366139373731343631363233636331 + 66323031656563613837343132633134393839666634633139303031303130633762323063363430 + 61663564313765303636633036353461303736636436353961613261393433393366393230653166 + 373831393537663239653835393461356331 + +buildbot_workers: + - name: scherer8-buildbot1 + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 61326566313864366463393435376262306337613962393463646535323965333330663239316537 + 6431656431363262353261633636623634363165303338360a323639373531386332353566366530 + 31643466313732383232653466383736363761303665323639396430346563333536636636303561 + 3430353439613438640a623732336335643532373832333539303232313539316338343363323733 + 3031 + maxbuilds: 1 + cpus_per_build: 3 + notify_on_missing: isprotejesvalkata@gmail.com + - name: scherer8-buildbot2 + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 33663438333331386563623930653832623862363039366233663733326136306561363432366430 + 3739323832636235633935616536623339663862333934650a316462633932613566363130386238 + 33666335333061663466663765333261303637323532363430303138643639623535653364303137 + 6563343738396665370a653432303737643832616132383533353064383962613366303738313635 + 3238 + maxbuilds: 1 + cpus_per_build: 3 + notify_on_missing: isprotejesvalkata@gmail.com + - name: ionos-worker01 + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 31323230353134306639383832386232656466313632313036643731306134303264636366643836 + 6632346431663032313731353533373032383330353736320a353732633065386137323062613166 + 34383930343561323737653066313161343534326265323931346335373538336363303236643236 + 6336613161346231650a356462626563316635613062613435353639313433383461366431666339 + 37306263646236663265643035613736393661353761343632656137316339396338 + maxbuilds: 1 + cpus_per_build: 3 + notify_on_missing: martin.hubner@web.de + - name: ionos-worker02 + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 37346337313536623039316561316237396364393635383439376138343437666535643365336164 + 3266306163636435306466343961616432626530373833350a306561653936653836323465356361 + 61383263653763626564626563643633336362313832633837326530636362626638623037313438 + 6665336331376435370a383435313133393636346635383863306561663133646339363162393234 + 3535 + maxbuilds: 1 + cpus_per_build: 3 + notify_on_missing: martin.hubner@web.de + - name: ionos-worker03 + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 38376139383663633034663666366338626139643338663734613062333433396461663030303665 + 6439376136376264303439356361663035343766343666380a343565663837613730666561613332 + 35663430333535383062653837613839636132313362623130353235373536383336383665633533 + 3237666335343561360a313131363532393333336437353838623534333634336533626532613933 + 32303463643964303830633064396364343538393465643438346630353131306639653437323464 + 3333383031616232346362313630376462666466643539316363 + maxbuilds: 1 + cpus_per_build: 3 + notify_on_missing: martin.hubner@web.de + - name: ionos-worker04 + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 34663662343435393735636263333031393431343263373564326131356666343533323862613936 + 3037643662363836373435333263383839396138386432620a666662356161343131356534356666 + 66353931646137646435393065306236313136633366313035653336613632343361373164316163 + 3265316633393233620a616534383864653964643536353561333162623239376661366531326637 + 66643238376231363666313064356662356533383862653234336261353436306364356335336333 + 39653732343539623835643831316231353834336330366330336337313438613135383730356539 + 613035626265626439616562653861363764 + maxbuilds: 1 + cpus_per_build: 3 + notify_on_missing: martin.hubner@web.de + - name: akira-home + passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 35333562313331316636626430333565623232386430333730323432386239636438396663363239 + 3364646463643339623835623464623565623038613665610a626466353935386465353137643933 + 33333733326534373766633933386361656335623837636537343937323238363939633332383132 + 3364306465323866640a356638343064633630376366313565653961393632383536353766633166 + 36306362326164373566653331393231386262356331386663616566316531386638653538326334 + 66626438613638316564306533363131656534396231646235613137383463353232666465373235 + 396234343335346232333032313737313661 + maxbuilds: 1 + cpus_per_build: 4 + notify_on_missing: martin.hubner@web.de diff --git a/inventory/host_vars/buildbot-worker-scherer8-1/main.yml b/inventory/host_vars/buildbot-worker-scherer8-1/main.yml new file mode 100644 index 0000000..8ed440b --- /dev/null +++ b/inventory/host_vars/buildbot-worker-scherer8-1/main.yml @@ -0,0 +1,16 @@ +--- +bbworker_name: scherer8-buildbot1 +bbworker_pwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 65616139363261663264613737303139326635626531643937633035313935306461363866663635 + 6161626635666530323261646137363063343366343161390a346334346532373562343935343638 + 31333938643639373931633662333466306337386233343263373931393938613234303135633030 + 3133376230613137300a333566333033373535336234373362613836366162396530356534323465 + 6635 + +bbworker_contact: Perry +bbworker_info: Xeon 3.6GHz, 3 Cores, 20GB RAM, Ramdisk + +bbworker_path: /ramdisk/bb_worker/ +bbworker_ramdisk: yes +bbworker_ramdisk_size: 18G diff --git a/inventory/host_vars/buildbot-worker-scherer8-2/main.yml b/inventory/host_vars/buildbot-worker-scherer8-2/main.yml new file mode 100644 index 0000000..7dfed6c --- /dev/null +++ b/inventory/host_vars/buildbot-worker-scherer8-2/main.yml @@ -0,0 +1,16 @@ +--- +bbworker_name: scherer8-buildbot2 +bbworker_pwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 32623638393834626563363534346262653831616566343336353764626431633432353464666131 + 3562363539366237626565333431653231663863633939640a646532356261316665626530343832 + 36663332366464303663303138306133353430613537386336383532613232326538366331613163 + 3561333461616565340a343065393833623330633032343761363865313930633436633234653637 + 3838 + +bbworker_contact: Perry +bbworker_info: Xeon 3.6GHz, 3 Cores, 20GB RAM, Ramdisk + +bbworker_path: /ramdisk/bb_worker/ +bbworker_ramdisk: yes +bbworker_ramdisk_size: 18G diff --git a/inventory/host_vars/buildbot-worker-scherer8/main.yml b/inventory/host_vars/buildbot-worker-scherer8/main.yml deleted file mode 100644 index 905734d..0000000 --- a/inventory/host_vars/buildbot-worker-scherer8/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -bbworker_name: scherer8-buildbot -bbworker_pwd: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 36613534396238373130313633326162643830316566656231616562623464653265316633376438 - 3466353430663635383263336133316261633339356337370a376330353437363061353064653238 - 62623431643533356337316632653032656234396637303430623231663433333064666639373630 - 3839313730393261380a356263666164356137353230396535386432366462643133333337613837 - 38363432653565353637623762346335643638643662303063303461356536623938 - -bbworker_contact: Perry -bbworker_info: Xeon 3.6GHz, 16 Cores, 60GB Ramdisk - -bbworker_path: /ramdisk/bb_worker/ diff --git a/inventory/hosts b/inventory/hosts index baba991..9616f72 100644 --- a/inventory/hosts +++ b/inventory/hosts @@ -12,9 +12,11 @@ buildbot-worker-01 ansible_host=85.215.202.123 buildbot-worker-02 ansible_host=85.215.248.194 buildbot-worker-03 ansible_host=85.215.225.21 buildbot-worker-04 ansible_host=85.215.162.88 -buildbot-worker-akira ansible_host=192.168.16.7 # only from within martins home... -buildbot-worker-scherer8 ansible_host=scherer8-buildbot.olsr # only from within freifunk-net use a jump-host or so... -buildbot.berlin.freifunk.net # the buildbot master runs additionally the master-worker. Thus having the worker-role too. +buildbot-worker-akira ansible_host=192.168.16.7 # only from within martins home... +buildbot-worker-scherer8-1 ansible_host=martin@scherer8-buildbot1.olsr # only from within freifunk-net use a jump-host or so... +buildbot-worker-scherer8-2 ansible_host=martin@scherer8-buildbot2.olsr # only from within freifunk-net use a jump-host or so... +buildbot.berlin.freifunk.net # the buildbot master runs additionally the master-worker. Thus having the worker-role too. + [tunneldigger] b.tunnel.berlin.freifunk.net # freifunk-gw01 diff --git a/roles/buildbot_worker/defaults/main.yml b/roles/buildbot_worker/defaults/main.yml index cde2b4e..86241f5 100644 --- a/roles/buildbot_worker/defaults/main.yml +++ b/roles/buildbot_worker/defaults/main.yml @@ -11,4 +11,5 @@ bbworker_info: Worker administered by ffb-ansible-repo machine_user: bbworker # gets overridden on hosts, that use a ramdisk +bbworker_ramdisk: no bbworker_path: /home/{{ machine_user }}/{{ bbworker_dir }} diff --git a/roles/buildbot_worker/handlers/main.yml b/roles/buildbot_worker/handlers/main.yml index 6d25a9b..e2363fa 100644 --- a/roles/buildbot_worker/handlers/main.yml +++ b/roles/buildbot_worker/handlers/main.yml @@ -9,3 +9,10 @@ - name: Initialise buildbot-worker command: "{{ bbworker_path }}/env/bin/buildbot-worker create-worker --umask=0o22 {{ bbworker_path }} {{ bbmaster_fqdn }}:{{ bbmaster_port }} {{ bbworker_name }} {{ bbworker_pwd }}" become_user: "{{ machine_user }}" + +- name: Restart podman + systemd: + daemon_reload: true + name: podman + enabled: true + state: restarted diff --git a/roles/buildbot_worker/tasks/main.yml b/roles/buildbot_worker/tasks/main.yml index a9eb05e..a4db71c 100644 --- a/roles/buildbot_worker/tasks/main.yml +++ b/roles/buildbot_worker/tasks/main.yml @@ -8,6 +8,7 @@ - rsync - time - podman + - dbus-x11 state: present update_cache: true cache_valid_time: 3600 @@ -16,6 +17,66 @@ user: name: "{{ machine_user }}" +- name: Create mountpoint for ramdisk + ansible.builtin.file: + path: /ramdisk/ + state: directory + mode: '0755' + owner: "{{ machine_user }}" + group: "{{ machine_user }}" + when: bbworker_ramdisk + +- name: Create ramdisk mount and persist + ansible.posix.mount: + path: /ramdisk/ + src: tmpfs + fstype: tmpfs + opts: "size={{ bbworker_ramdisk_size }}" + state: present + boot: yes + when: bbworker_ramdisk + become: true + +- name: Create bbworker_path + ansible.builtin.file: + path: "{{ bbworker_path }}" + state: directory + mode: '0755' + owner: "{{ machine_user }}" + group: "{{ machine_user }}" + +- name: Create path for custom podman storage config + ansible.builtin.file: + path: "/home/{{ machine_user }}/.config/containers/" + state: directory + mode: '0755' + owner: "{{ machine_user }}" + group: "{{ machine_user }}" + when: bbworker_ramdisk + +- name: Custom podman storage config + ansible.builtin.copy: + dest: "/home/{{ machine_user }}/.config/containers/storage.conf" + mode: '0644' + content: | + [storage] + driver = "overlay" + runroot = "{{ bbworker_path }}/run/user/$UID/run" + graphroot = "{{ bbworker_path }}/.local/share/containers/storage/" + owner: "{{ machine_user }}" + group: "{{ machine_user }}" + when: bbworker_ramdisk + notify: Restart podman + +- name: Add buildbot-worker systemd-service-module + ansible.builtin.template: + dest: /etc/systemd/system/buildbot-worker.service + src: systemd-unit.j2 + mode: "0644" + owner: root + group: root + notify: Restart buildbot-worker + - name: Install buildbot-worker pip: name: buildbot-worker @@ -27,6 +88,42 @@ - Initialise buildbot-worker - Restart buildbot-worker +#- name: Reinstall ramdisk-Worker script (reinstall on boot) +# ansible.builtin.copy: +# dest: "/home/{{ machine_user }}/reinstall_bbworker.sh" +# mode: '0644' +# content: | +# #!/bin/bash +# # (re-)creates the buildbot work er on the ramdisk, everytime the system reboots. +# mkdir -p "{{ bbworker_path }}" +# virtualenv "{{ bbworker_path }}env" +# pip install buildbot-worker=={{ buildbot_version }} +# source "{{ bbworker_path }}env/bin/activate" +# "{{ bbworker_path }}/env/bin/buildbot-worker create-worker --umask=0o22 {{ bbworker_path }} {{ bbmaster_fqdn }}:{{ bbmaster_port }} {{ bbworker_name }} {{ bbworker_pwd }}" +# owner: "{{ machine_user }}" +# group: "{{ machine_user }}" +# when: bbworker_ramdisk +# +#- name: Persist ramdisk-Worker +# ansible.builtin.copy: +# dest: "/home/{{ machine_user }}/reinstall_bbworker.sh" +# mode: '0644' +# content: | +# #!/bin/bash +# # (re-)creates the buildbot work er on the ramdisk, everytime the system reboots. +# +# mkdir -p "{{ bbworker_path }}" +# virtualenv "{{ bbworker_path }}env" +# pip install buildbot-worker=={{ buildbot_version }} +# +# source "{{ bbworker_path }}env/bin/activate" +# "{{ bbworker_path }}/env/bin/buildbot-worker create-worker --umask=0o22 {{ bbworker_path }} {{ bbmaster_fqdn }}:{{ bbmaster_port }} {{ bbworker_name }} {{ bbworker_pwd }}" +# +# exit 0 +# owner: "{{ machine_user }}" +# group: "{{ machine_user }}" +# when: bbworker_ramdisk + - name: Flush handlers meta: flush_handlers @@ -57,12 +154,15 @@ group: "{{ machine_user }}" recurse: true notify: Restart buildbot-worker + when: not bbworker_ramdisk -- name: Add buildbot-worker systemd-service-module - template: - dest: /etc/systemd/system/buildbot-worker.service - src: systemd-unit.j2 - mode: "0644" - owner: root - group: root +- name: Adjust permissions on buildbot-worker description + ansible.builtin.file: + path: "{{ bbworker_path }}" + state: directory + # needs to be this high. Otherwise service will not start. + mode: "0755" + owner: "{{ machine_user }}" + group: "{{ machine_user }}" notify: Restart buildbot-worker + when: bbworker_ramdisk diff --git a/roles/buildbot_worker/templates/systemd-unit.j2 b/roles/buildbot_worker/templates/systemd-unit.j2 index 222fbe5..57209fb 100644 --- a/roles/buildbot_worker/templates/systemd-unit.j2 +++ b/roles/buildbot_worker/templates/systemd-unit.j2 @@ -8,6 +8,14 @@ After=network.target User=bbworker Group=bbworker WorkingDirectory={{ bbworker_path }} +{% if bbworker_ramdisk %} +# recreates the worker after a reboot +ExecStartPre=mkdir -p "{{ bbworker_path }}" +virtualenv "{{ bbworker_path }}env" +pip install buildbot-worker=={{ buildbot_version }} +source "{{ bbworker_path }}env/bin/activate" +{{ bbworker_path }}/env/bin/buildbot-worker create-worker --umask=0o22 {{ bbworker_path }} {{ bbmaster_fqdn }}:{{ bbmaster_port }} {{ bbworker_name }} {{ bbworker_pwd }} +{% endif %} ExecStart={{ bbworker_path }}/env/bin/buildbot-worker start --nodaemon [Install]