diff --git a/.cache_ggshield b/.cache_ggshield deleted file mode 100644 index 957891a4..00000000 --- a/.cache_ggshield +++ /dev/null @@ -1 +0,0 @@ -{"last_found_secrets": [{"name": "Generic Password - /home/charish/app-configs/searxng_settings.yml.j2", "match": "6e0d657eb1f0fbc40cf0b8f3c3873ef627cc9cb7c4108d1c07d979c04bc8a4bb"}]} \ No newline at end of file diff --git a/.gitea/workflows/pr-cloudflare-docker-deploy.yml b/.gitea/workflows/pr-cloudflare-docker-deploy.yml index 53e461c8..fbd3c86b 100644 --- a/.gitea/workflows/pr-cloudflare-docker-deploy.yml +++ b/.gitea/workflows/pr-cloudflare-docker-deploy.yml @@ -5,7 +5,6 @@ on: - main paths: - '**.yml' - jobs: check-and-create-pr: name: Check and Create PR @@ -51,9 +50,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - # Cache Ansible Galaxy Collections - name: Cache Ansible Galaxy Collections uses: actions/cache@v3 with: @@ -61,47 +57,33 @@ jobs: key: ${{ runner.os }}-ansible-${{ hashFiles('./ansible/collections/requirements.yml') }} restore-keys: | ${{ runner.os }}-ansible- - # Install Ansible - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - name: Install Ansible - run: | - python3 -m pip install --upgrade pip - pip3 install ansible + uses: alex-oleshkevich/setup-ansible@v1.0.1 + with: + version: "11.0.0" - name: Install Vault uses: cpanato/vault-installer@main - # Install Galaxy Collections - - name: Install Galaxy Collections - if: steps.cache-ansible-galaxy-collections.outputs.cache-hit != 'true' - run: | - ansible-galaxy collection install -r ansible/collections/requirements.yml -p ansible/collections - # Run Docker Config Deployment - - name: Docker Config Deployment - id: docker-config-deploy - uses: arillso/action.playbook@0.0.8 + - name: Install hvac + run: pip install hvac + - name: Ansible Playbook Dry Run + uses: dawidd6/action-ansible-playbook@v2 with: - check: true - diff: true - galaxy_collections_path: ansible/collections - galaxy_requirements_file: ansible/collections/requirements.yml - inventory: ansible/ansible-inventory.yml - playbook: ansible/docker_config_deploy.yml - private_key: ${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }} + directory: ansible/ + playbook: docker_config_deploy.yml + key: ${{secrets.RINOA_ANSIBLE_PRIVATE_KEY}} + options: | + --inventory inventory/hosts.yml + --check + requirements: collections/requirements.yml vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} - verbose: 1 - # Generate .env File - name: Generate .env file for Docker Compose Dry Run run: | vault kv get -format=json rinoa-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env - # Cache .env File - name: Cache .env Files uses: actions/cache@v3 with: path: .env key: ${{ runner.os }}-env-${{ hashFiles('docker-compose.yml') }} - # Docker Compose Dry Run - name: Docker Compose Dry Run uses: yu-ichiro/spin-up-docker-compose-action@v1 with: @@ -214,11 +196,10 @@ jobs: id: pr_merge run: | tea login add --name gitea-rinoa --url ${{ secrets.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }} - echo "Setting default login for Gitea..." tea login default gitea-rinoa - pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ github.ref_name }} | awk -F, '{print $1}' | sed -e 's|"||g') - echo "${pr_index}" - tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR #${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" --output table ${pr_index} + echo "Merging PR..." + pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ github.ref_name }} | awk -F"," '{print $1}' | sed -e 's|"||g') + tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index} ansible-config-docker-compose-deploy: name: Deploy via Ansible & Docker Compose runs-on: ubuntu-latest @@ -235,6 +216,18 @@ jobs: ref: main - name: Install Vault uses: cpanato/vault-installer@main + - name: Install hvac + run: pip install hvac + - name: Deploy Docker Configs via Ansible + uses: dawidd6/action-ansible-playbook@v2 + with: + directory: ansible/ + playbook: docker_config_deploy.yml + key: ${{secrets.RINOA_ANSIBLE_PRIVATE_KEY}} + options: | + --inventory inventory/hosts.yml + requirements: collections/requirements.yml + vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} - name: Gotify Notification uses: eikendev/gotify-action@master with: @@ -242,17 +235,6 @@ jobs: gotify_app_token: '${{ secrets.gotify_app_token }}' notification_title: 'Ansible Config Deployment @ Rinoa' notification_message: 'Deployment completed successfully.' - - name: Docker Config Deployment via Ansible - id: docker-config-deploy - uses: arillso/action.playbook@0.0.8 - with: - galaxy_collections_path: ansible/collections - galaxy_requirements_file: ansible/collections/requirements.yml - inventory: ansible/ansible-inventory - playbook: ansible/docker_config_deploy.yml - private_key: ${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }} - vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} - verbose: 1 - name: Generate .env file for deployment run: | vault kv get -format=json rinoa-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env @@ -269,5 +251,5 @@ jobs: with: gotify_api_base: '${{ secrets.gotify_api_base }}' gotify_app_token: '${{ secrets.gotify_app_token }}' - notification_title: 'Docker ComposeDeployment @ Rinoa' + notification_title: 'Docker Compose Deployment @ Rinoa' notification_message: 'Deployment completed successfully.' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9455a820..2bbb354e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -**/.cache.ggshield +**/.cache_ggshield ansible/collections/ansible_collections/ \ No newline at end of file diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index b9c645bf..0b15c2ba 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,6 +1,6 @@ [defaults] # Specify the inventory file -inventory = hosts.yml +inventory = inventory/hosts.yml collections_path = ./collections # Set the logging verbosity level diff --git a/ansible/app-configs/gitea-sonarqube-bot_config.yaml.j2 b/ansible/app-configs/gitea_gitea-sonarqube-bot_config.yaml.j2 similarity index 100% rename from ansible/app-configs/gitea-sonarqube-bot_config.yaml.j2 rename to ansible/app-configs/gitea_gitea-sonarqube-bot_config.yaml.j2 diff --git a/ansible/app-configs/sabnzbd.ini.j2 b/ansible/app-configs/sabnzbd_sabnzbd.ini.j2 similarity index 100% rename from ansible/app-configs/sabnzbd.ini.j2 rename to ansible/app-configs/sabnzbd_sabnzbd.ini.j2 diff --git a/ansible/app-configs/sonarr_config.xml.j2 b/ansible/app-configs/sonarr_config.xml.j2 index 1afdc004..cb4f0f35 100644 --- a/ansible/app-configs/sonarr_config.xml.j2 +++ b/ansible/app-configs/sonarr_config.xml.j2 @@ -1,5 +1,5 @@ {% set vault_addr = 'https://vault.trez.wtf' %} -{% set secrets_path = rinoa-docker/env %} +{% set secrets_path = 'rinoa-docker/env' %} info @@ -8,7 +8,7 @@ 9898 * - 386baee1c0e741bea4a91f1f39c57f68 + {{ lookup('community.hashi_vault.vault_kv2_get', 'env', engine_mount_point='rinoa-docker', url=vault_addr, token=vault_token_cleaned)['secret']['SONARR_API_KEY'] }} Forms Docker True diff --git a/ansible/docker_config_deploy.yml b/ansible/docker_config_deploy.yml index 9b6cb950..798016c4 100644 --- a/ansible/docker_config_deploy.yml +++ b/ansible/docker_config_deploy.yml @@ -1,5 +1,5 @@ --- -- name: Deploy config templates and trigger GitHub workflow +- name: Deploy Docker Service Configurations hosts: rinoa vars: appdata_base_path: "~/.docker/config/appdata" diff --git a/ansible/inventory/host_vars.yml b/ansible/inventory/host_vars.yml index 3c50f7d9..24038d37 100644 --- a/ansible/inventory/host_vars.yml +++ b/ansible/inventory/host_vars.yml @@ -1,12 +1,13 @@ -ansible_host: 192.168.1.254 -ansible_python_interpreter: /usr/bin/python3 -ansible_ssh_port: 22 -ansible_ssh_user: charish -ansible_ssh_pass: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 38346631616139316365316566386362396661323163306339303635646331373061323531626431 - 3435373031363739356261656239633835393963636663370a613166653463656337666366633639 - 37373637326633363430633336646165343764303063663636313835326130663532323037663331 - 6332353339656134370a353435396532663932313535646636333262353238386331313764633635 - 63383065623930653134666261353439366535646661383434386261393232373432353937636535 - 3432336137393737643735346665303832653630316439333565 +rinoa: + ansible_host: 192.168.1.254 + ansible_python_interpreter: /usr/bin/python3 + ansible_ssh_port: 22 + ansible_ssh_user: charish + ansible_ssh_pass: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 38346631616139316365316566386362396661323163306339303635646331373061323531626431 + 3435373031363739356261656239633835393963636663370a613166653463656337666366633639 + 37373637326633363430633336646165343764303063663636313835326130663532323037663331 + 6332353339656134370a353435396532663932313535646636333262353238386331313764633635 + 63383065623930653134666261353439366535646661383434386261393232373432353937636535 + 3432336137393737643735346665303832653630316439333565 diff --git a/ansible/sshprkey b/ansible/sshprkey deleted file mode 100644 index 1efb24f8..00000000 --- a/ansible/sshprkey +++ /dev/null @@ -1,135 +0,0 @@ -$ANSIBLE_VAULT;1.1;AES256 -61353462613766353733306330373236633138333538613634653533316430363930633630626631 -3035333733316133643133356134366366343337363032330a316536353561643436373536336563 -61343566373439376138393533313064313537343831386536623632353262386566633464633661 -6161396538323162310a333866383339393535303236633162303038343134623965646331653262 -35633466383131646465393338313036393164323865353366316366313263303735616539386334 -38666262373336326431306236633662666335303135633965326131663437356565613632636436 -32636362393939336636376363666461653563356431316161306631633634376132623636396461 -61353138323062333937313033313230343136343733303339386362616161383564653363383531 -34646463666166326131626361653666626633366535356534396239613838373063613136303034 -31623363633436303238646233363431343933393534346635383362336361323633396430366561 -30323035613132323634656531353831613961646534306636346466623932383637303830396239 -63646361386263316662393533336536396462623930646466393632363166353234383632313930 -31633030303961343830346334613765333039653734313733396533326434383838626537656564 -66646464616566356533653939333330376339666234656137336361633263396165323963343938 -32313261353237636233343238366334306665353333643933376130336331323132393037663461 -35653132333935636132666363333033396630643466303933393434646432336166633461386263 -66316433663831623730303838343566633237363832353933333063356661353564306461383662 -64646530336662346633616335313064663135613439653663653434623931303333613639356633 -64613639653065613962373233656663366462343663623964313338356462336239373830623466 -31316164346437333331336335613336333935323961353335313635636230386339363262616266 -30316533313664623966323230373137653533626563376638386430613465663937343939626661 -65663031663931383465366663383936343338383937356463623431656633653363363137336261 -31663762643132386461333732613330636433326139663133633462343435353065313431663834 -65616232353539653632393337653863346638316233656636383735386265343434613139636230 -62653232653430356539663334653134663536336136343133666461396232303038343934376463 -62623262356638663538343862376365333235366137383535643431353837303762306637653939 -35333130346237353432616130353261386237666366306436353439396630646430343739323330 -35373664656465626538313139383462356435396631343666623437343933393938666464383834 -36613363663534613566633434643466666365396238363837326362646430353034653133616438 -61336233663332336333643564663336333935343266353265376664666135396530656639623338 -34313462333563636564366330636464656263663236303437366564363439646430356338373337 -32353435313164323636336537386437656439306231656139633234303363623363303937383464 -38663736656663316334303937626264666138643434623736336630353663373035363938373630 -36303933613766613763646638316365306539373332623731373363643261373931393733323038 -61303966373733623362353963346433653931303334313664636531313531373932313465326162 -35366136386236613930663037353765393464366234303165636635393763363433316466363438 -33396334623764356362393035626631666363646433356561333633313837303438333734313836 -38343935626334313063316639356436303331643535633230653439326332386432333831336131 -36633732636537353936663838393937326135623261663565323963393335616665323233336435 -62663662303138643239313061323233316262333362323266333739333564316431303964643033 -62313134613031363063333731653634393363356238313463343066636234356239303139313065 -37346532383133323932323164626663663437313166343235653962383162383138373165663865 -61363237323662616634626137393934396131303934623865363133313863396635353964613863 -61376431663134303863663764353238626131623138623030363734366233613637623932356235 -32343664346566383939353137343434316532393639326435616365326565393736663163303861 -37316461303237333861306465613537626337396532356163356235626563356137316330613134 -65636131663633633936613736326338643133336636316461316335653062666631363933323465 -37656564396161363637363238373635626565373334626539633634336561643364316331633132 -32643431616432616562343538366638663238376332666566343237626539336534663162643062 -37376434363661323137356130623135346430633235643530356366343461326534656562363262 -61653365326363366336363933326232373363626430353561646339376236333639346130383537 -64323832323762353964346434313236613436643762306636666134373730646633313032346136 -37636564633365653234373034303933333864636139666132386665666430663136393939626332 -39343234363032646266323862663937626438623237313865656632306666373663633734353132 -33646531333363313031666565653662333039653866633563626564666434356364396530666532 -36326566663138663031616635366134666364656639313265643662633861353030373132306565 -34366665366562623230393066643538396337653361346130326630326338363937353834333664 -64343633373866333562313535386131323336643336376666663836343265306563356466636630 -65363239333937386161616638393464613339316261313764636535326137663861386330353464 -31653232313930663465663036336232306666363865646231643865316366303561303662383730 -38653566356331613430613462643235366636313961373535366639353565623836336637363233 -35333334613566326637633161346638663136666465356461383765663237623631663138613034 -63633766313032363366633838666131303335656139373661316333326661326238366138343435 -39363861393064333532666330313764316539636364393138613939366536653830653932326638 -63303338333934353536646637333065386532383239643933366438616234353839646533336236 -30633465353730653531663333356636393334616534616635333563363136306233323236653266 -39626434363862656465336364333737623461346231613139373031326531396633366432386561 -63363631376634373862646138363565366533636330623366393530306135363261333433303961 -31366362333263636265386434333566616264666562323762666133646139356364626563343663 -31313834303737356638393065336134323762663265623662333061626239393133363465663537 -37633436356631643465313665646365336134653436633762653430326263623230663335633531 -65313532616430616162386265333336323134393831613663386238383936376665346164646239 -65353362626336373661373364313034313533646132623638623063353937313337313539353134 -62623733363339386465633063306465333632353435363532316263303839343231643235313862 -65346137613863353364383430616465643435356162373731323035623431643639396162646139 -31376430386661303164366365653838636662373762623330306534376231313938633837353663 -30333661303961363434313166323933613131366162623466306133333032353035343836646631 -37336232386364663533313261376230336539303933353339323865363962303733316365316438 -30636235393735396637353331623532376534636465666234373231313039323638366631633234 -61353231666565373764663235313130303365613630393661653434383738333066663961366165 -37323334643932626136636631373761393537343764663931646261613361313261373462386430 -65623634303030366230373165623434316461656661336261626335653031633664336265633431 -63646534616438326139353030336236303734616365383166343537393732623930316235616330 -38366430633062313431396633626665376234626663336534643632616139373566303835303564 -32326363393535663137616430616233663463636133363231663739336264663862613832313663 -66343839323861646635666331613236356336316361376162323964313663393030633332313662 -63323634363435346536663637363935323266346639366161643535313031663261633865313936 -34643163323861663432393330663763346138343930313639613139376138376263323232656631 -66623065326336323631313564666430363836386439396533393665396233323465646636643532 -39666364643933643363666164633931333635313233323365373135363833663964333430653338 -39643961626336376539653461643263626635383662323965363233623435386630653464303938 -64633536386535363031333063353633643632666134323464336166653533396437316566373732 -38366465646165313563396363656266653233393965623036623533623638643166356131623338 -31393863346564303865336430376462333831623339653935353664376166636665626637313031 -33353166366634656333663461353631633837663934333737393366373364663833313230333735 -62333333353361653533643233613464616664633736613138636666613932613061666230373565 -37643634376363373031643731366262303733313534303661326462366632656163393532666265 -66383061363336343837373831326135383430383831366563376165303661663732323437623134 -66633763313336376262376233363862663132356164313336393566313062386231633635653332 -65616335343738663565623161383730643735323937316535653032633032363532633434393639 -30343635666162373762376131663336653838626331306365333234333438306433666434613938 -34346137326264633366663332666330646364333938663262633637356263643937343262623834 -32323835623061656535313766643437373066363832353562633463636530386235313365376561 -62303162316365396164333065653638643065633665646436386365323263366237616138636531 -35313337643361656166643036333631656438326365386161303635613363383636346437613434 -66313631343863343939333261396266346333323632623361656638306234656330633635333733 -38376531353230343933613961376638353063346435623366343930313237663733346531323135 -64336239396137353465393361346437383565393638343930356365313163363264333834326139 -30383763336137346530653961613434306664373264316434616263306562623335663330616564 -37346565653562363866343937653238353332336135663766383239653038643130373165353462 -62306238643536336235623638363734656366663530373264663861313438373437306666393731 -33333237636535623631303134303138353434323533653931653762323330643466306565313630 -35366663346165333833626630323330336336303166643463396437383730643166303965363838 -39313739333334613262393135616232316436643835636430653237383739653536373962346161 -30643639303938393266613734346234316331633834643337373265313763393766323431333439 -32353036326333356535633136376630623733306636663363393434653033636431643063393939 -63653164363435306232636536333739633832346137373130303265383135396334343062396463 -30303434613034316365653464343265393736386265623366643763386265316462396464346162 -32623138393363613636336435666233366630653030326561336338306339663837303033366134 -32616334313539653763396164656133613736303335646564633736393463313261613831623664 -38613032333766376135363437313561643863333036363766343333303664303738623738666634 -66623032306337326361383466303431616531313535316134336338656437653134653738393662 -64373437363762633261373533313730383932306161376636393261623534663737633639653462 -66663732306239313764383264663362346433346265303732333535613563613033616165343037 -62633565643433353332663534366564616132646337356265346234366537653561316531356366 -61666163303362666232613164373963383131616336613030626262306136636265633531306133 -64646332336137353765626439346162636233363463313437633763656361653565343835393762 -64343433373938636461646265303238646635346662626331333436343535636231666563326462 -35373435396233313464366636343165376662616134633037376161393565336164646663323266 -36386634383066383763353535616466396464623836646439323535323839646632323839653838 -35383136343333326565383261653763383639313631663631343730353532613764306630326262 -37363665313637633162373264623464346431306537386231613131663934623933353433623031 -66326331666132643637323937376164306565343035363032623231303962313433356362613362 -3233366530336137393333373639613864613561363465306239