mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-09-08 21:27:36 +02:00
build
This commit is contained in:
+49
-45
@@ -1,46 +1,50 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
66666638396636616263626530656431633864306534656533306132333834393534666432646364
|
||||
3437633230646333646136383939643131313464623962620a343035656539663230663630376365
|
||||
31386233323766656532656263303936626363333639383463343732633765316366333566386336
|
||||
3639346336633437630a646139313461653064346464663134383062343538313935346333396334
|
||||
31343833623364386635316366353462616265633966366338653366323831306333333263323966
|
||||
37323966633636386436313961626665646266653639656263633932663432613331636435613739
|
||||
34396133343634633939306461666666383736326331643566313762376337633536343161623339
|
||||
33373163336139386433663637333132396564653664306431643663366234653137613063383937
|
||||
66613831343930383234366431363165386462376634343339663132393736343439643932383962
|
||||
62353038636163666561323863376162373035396537393336663737323835353232333162346262
|
||||
30333437356465313762376365346161656335353035633963386531316130643533356438653761
|
||||
65613934636435653336346139333566643839366465323330663134636463326436343362663962
|
||||
65633266643261336466333238326563303533326636316662393461386363363765303436303831
|
||||
65623030316636373737336335653032303739666234626137303132666665613536386337613437
|
||||
30653136343263333964316334616133326232663962333436373430666366303137343163363939
|
||||
62366266306630656662383834343230393233316238663163343832356337613533336161653065
|
||||
37623065643531383834333966666266396534363865663931643534643231643037303630343131
|
||||
33336335323833353831663664666134643731353630656132643763333839303937336564663538
|
||||
65366233653534396561663632666566633734663465333830333063303338393232316661633139
|
||||
34343636323832353335646566336538373535386533343234343565336365653766343866616565
|
||||
36323538613935323836373534383366396164336333313964303535623464303665623064626163
|
||||
30383634613263383631343135643439303664326134323266373461363262616235623965356130
|
||||
63353964373065396131373138333437363965396664663364303030616165663334393834653332
|
||||
63356130393563363262383862353231313662396166363135616334336261616533636165636533
|
||||
65633565656332316165363638633034636166646137653463363436663462343733623332313037
|
||||
64633563333861313032333234613031366666336531363731373233643462316263353565653634
|
||||
34646361303436373066646362313839373234616662326162646230336131643864633833666563
|
||||
39336639623532333539386530616533343463303735306161636335633630373939333130666364
|
||||
65333038636265386330366533666439336136633535316466633935316566643338643033373663
|
||||
38656430663361366136313535313861643133353531386133633535343562616662383930393939
|
||||
37306665656661623031656266353862343035316131306631346131656139656264363663333161
|
||||
66333938356635396664366636663134353536643161383030353136393064383933643736633738
|
||||
35396336313338636433366362666438653265343661333465343039333636326161396464666135
|
||||
62343737303436346331346462623664623530323236656332343864323130646363653539636531
|
||||
37666465616535393965303336373732636565396539663961396238373338363965306430633937
|
||||
35383264636162333239346465323066393030326239383437623931643338376161663865336534
|
||||
30356562316232633434623037383134353239663564633164333137366431316637663638646338
|
||||
66373763363131643635346139336335356536346561653838353330346230373936613934336132
|
||||
32366461313965393732386531363532353933306539363562383336303434386563633938626439
|
||||
36643639376439623562326230373566366232383338363135633134373861313937666438333263
|
||||
38323333643336323233353764643762663136393436633833623162646332396163626233363065
|
||||
39653237313232613330396239363239373631303631333530373535356230323934303965663938
|
||||
31633761373730633536656336633331323736326236363361616666386536633332633762613665
|
||||
38616234666438616432363661653833386330303333656263353933343139363766346134393566
|
||||
3463
|
||||
65316436333931393863333238383631633937653735643635326439396239336166363034623666
|
||||
6230643630336630356134353062376161303334663334650a616564326135663538663964366461
|
||||
66376238616466663734616433646630633661626139653936383863363765613463333730366236
|
||||
6139383162633038320a316161373335356231616238613331376163343134656339666630326365
|
||||
64386164653362623234353937373036623533633334313833336536363661633330643731303861
|
||||
65643739353938343465356361333661393431656561373930343230626633326238666533306138
|
||||
62373761373938306633393830376561363363306466396238643737613863373266313832643535
|
||||
32313362363433373461653037383164653265313536616230363032373836383637363639333264
|
||||
39653832316237343833636533646532316637323937353462303332343137313339613635623530
|
||||
64366637346335663732306437336231353963623737613364666138396633616362376130333965
|
||||
35656636366234303664623436633339306165343539323434623231393338626565353534666366
|
||||
38643533396535356265343161336530303532616565623539333265306334663339386335366630
|
||||
61666164363863323361623836313339393366303032383335346636363833313864336233626435
|
||||
35663734393965336135323531383130303032306533333932663263653237396664613037316632
|
||||
36393035643437333531656461353733386436666663346431353039616135376334623866346530
|
||||
63366234326535646662373566336332376262633963653134633865303431663133396164383031
|
||||
30626333363265333836306566373362313966346165326165636162393133336235343036366561
|
||||
64376564323264366466303832626162663937336232666436343730356233653138363761643464
|
||||
66653361653161663461653836373837623063323262316163333738613335316631663130373665
|
||||
39373133326630663566643564653337666266623831343336396262333236643836663333316239
|
||||
35313039646639393231663433623334363266306130333638386664313463353137363665343137
|
||||
35353635616238336234353031663839666563316364613636353534303665376339613639383639
|
||||
65633961353565346561616665666430383663626331303233346161626563323839323265363138
|
||||
65626236323937623561653466333937326334353464613265366632656562346339366231353837
|
||||
34346262356565373062306530353339323331333036666134323065633830636131623261353161
|
||||
65656562363334616231386238373964666563316236653561633939396663653034643063303030
|
||||
36326633653064323033623431386432666466363966653561383962303766333366313666656361
|
||||
32336163653532353565313836623366636565663036663834623464636138336138653032393530
|
||||
65393035313937653235616334643365376534626230666565633037643130333962346635613866
|
||||
39643438613733393037653237653538653934393437373465626366623966613362313165623537
|
||||
64633736663864646361653665313266363666323566616133653032633663373934643466656362
|
||||
66353631663964333637643661306638653265303364356530326133633166626166386261306336
|
||||
35613331313432333263306334333331333430376564663364313337633636336336313039356234
|
||||
38333064333361353430386136383562316664376131396435656635313131616265343232623739
|
||||
32323765656239386238666561666364616364346361393637313434633630303939366332323166
|
||||
63343362383266373665373365616165623662613639656235616332656232383933383432386663
|
||||
35653364336437353236613038363233393362353433313763333539306433383166626164373338
|
||||
35613965303932623164626234343265343465363962373561613166373131323037316234653130
|
||||
38343932353237326363663063373931663439353536303664303161306532396666646539336639
|
||||
35356131646233373735653937646462623335363336313431623438613462346631633566633035
|
||||
66313437646431333265653363366337383963363135366530393438383733633739633966616436
|
||||
31343761353166396636313262313233633564616363333536323834633266326464383630373935
|
||||
31633138363138393865376139346336316364616134636134373366616334363365366535656631
|
||||
32623638366135343162613936353562313363393530633735343665333430306630623535366235
|
||||
33393461373461643332613930333235313430633564616535623338303764303834373131633538
|
||||
64303661303361373831313863383563303035313231383365376162323536346430626561646165
|
||||
63613762643864636131613165343935376135323935666664333761383363613161393436336139
|
||||
34383230333530363261396366386635643866386361303731616132313435663663353737363038
|
||||
34333230643039366463353363383861363133626233613933336434396536383536
|
||||
|
||||
@@ -1,30 +1,57 @@
|
||||
- name: Setup vault SSH keys
|
||||
become: "{{ 'no' if inventory_hostname in ['sectorq.cloud', 'nas.home.lan'] else 'yes' }}"
|
||||
block:
|
||||
|
||||
- name: Include vault
|
||||
ansible.builtin.include_vars:
|
||||
file: init.yml
|
||||
|
||||
- name: Install required dependencies
|
||||
ansible.builtin.dnf:
|
||||
- name: Facts
|
||||
ansible.builtin.setup:
|
||||
when: ansible_facts.architecture is not defined
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
name:
|
||||
- dnf-plugins-core
|
||||
- curl
|
||||
- wget
|
||||
- unzip
|
||||
- gnupg
|
||||
- python3-debian
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Download HashiCorp GPG key
|
||||
ansible.builtin.get_url:
|
||||
url: https://apt.releases.hashicorp.com/gpg
|
||||
dest: /tmp/hashicorp.gpg
|
||||
mode: '0644'
|
||||
|
||||
- name: Dearmor HashiCorp GPG key
|
||||
ansible.builtin.command:
|
||||
cmd: gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg /tmp/hashicorp.gpg
|
||||
args:
|
||||
creates: /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
||||
|
||||
- name: Read os-release
|
||||
ansible.builtin.slurp:
|
||||
src: /etc/os-release
|
||||
register: os_release
|
||||
|
||||
- name: Extract UBUNTU_CODENAME
|
||||
ansible.builtin.set_fact:
|
||||
ubuntu_codename: "{{ (os_release.content | b64decode).split('\n')
|
||||
| select('match', '^UBUNTU_CODENAME=')
|
||||
| map('regex_replace', '^UBUNTU_CODENAME=', '')
|
||||
| first }}"
|
||||
|
||||
- name: Add HashiCorp APT repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: >-
|
||||
deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg]
|
||||
https://apt.releases.hashicorp.com {{ ubuntu_codename }} main
|
||||
filename: hashicorp
|
||||
state: present
|
||||
|
||||
- name: Add HashiCorp repository
|
||||
ansible.builtin.get_url:
|
||||
url: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
|
||||
dest: /etc/yum.repos.d/hashicorp.repo
|
||||
mode: "0644"
|
||||
|
||||
- name: Clean DNF cache
|
||||
ansible.builtin.command: dnf clean all
|
||||
changed_when: false
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install Vault
|
||||
ansible.builtin.dnf:
|
||||
apt:
|
||||
name: vault
|
||||
state: present
|
||||
update_cache: yes
|
||||
@@ -85,9 +112,13 @@
|
||||
}
|
||||
|
||||
auto_auth {
|
||||
method "token_file" {
|
||||
method "approle" {
|
||||
mount_path = "auth/approle"
|
||||
|
||||
config = {
|
||||
token_file_path = "/etc/vault-agent/token"
|
||||
role_id_file_path = "/etc/vault-agent/role_id"
|
||||
secret_id_file_path = "/etc/vault-agent/secret_id"
|
||||
remove_secret_id_file_after_reading = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +129,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template {
|
||||
destination = "/home/jd/.ssh/id_ed25519-cert.pub"
|
||||
perms = "0644"
|
||||
@@ -113,13 +145,15 @@
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: Create file with token for vault agent
|
||||
- name: Create secret id file
|
||||
copy:
|
||||
dest: /etc/vault-agent/token
|
||||
content: "{{ vault_sshcert_token }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0600'
|
||||
dest: /etc/vault-agent/secret_id
|
||||
content: "{{ vault_secret_id }}"
|
||||
|
||||
- name: Create role id file
|
||||
copy:
|
||||
dest: /etc/vault-agent/role_id
|
||||
content: "{{ vault_role_id }}"
|
||||
|
||||
- name: Create service for vault agent
|
||||
copy:
|
||||
|
||||
Reference in New Issue
Block a user