make corevm_ssh_key a var + make docker_dir customizable

This commit is contained in:
Arya 2023-07-14 17:19:15 +05:30
parent d95d114d10
commit 5d525e0c4e
Signed by: arya
GPG Key ID: 842D12BDA50DF120
4 changed files with 52 additions and 16 deletions

View File

@ -119,7 +119,7 @@
- name: Add extra authorized_key for soleil
ansible.posix.authorized_key:
user: "{{ item }}"
key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCn7RsO05kXSKBBopwzAri/MfhRwA+iuB1X96jQl0rhYvGmYVZLi0CPyXzE2laL5tRiyXYsIgHTVCfsn+CF+ilFXBa+xLcJ9Yau/SjtnZASixljeZuy0o3aTdl/IqcOcLVCdDaatuzOXFTjZCE+r67FqxFcaw9lzWi7QjtE1j8ar5+qo278XWWltYogxccHXBXqDr2chz95Ye0lAEIWp0LOgkSYjVNNKaAc7Y6kwr7SlwKMdlfbY6WPOyRQX5l1rnpU6Cw4mRf+l06+drpkGFIll3dulm0CNIoXYVy3W5Hr+C0Z6FT0bqZP1NuG1bDWTlwbMD3jIfBqhTI3V7oL5EvHCh3KsHfE7bS97F7MoeNx1xZrj2zIbkakdsxvm5oXra2RXpLbQXEzZDntGYoPaJT70yvnBSpxNDtzhUzZKwlTZIGN3LU/9USfmVTphZAR7l/BmT+j64eUZevuy3ht6iQQigkmi6KwXySXlUuUq2pXwTA/Dq1er3NclwTwT+v1QJ8= user@CoreVM"
key: corevm_ssh_key
with_items:
- "{{ users }}"
- name: Configure SSHD

View File

@ -13,6 +13,10 @@ all:
ansible_user: ansiblerunner
ansible_port: 22
port: 22
docker_dir: /opt/docker-privfrontends
country: France
isp: Orange S.A.
wiki_page: Soleil_Levant
ansible_become: true # Run everything as root
lxc:
ansible_host: lxc.vpn.projectsegfau.lt
@ -39,6 +43,7 @@ all:
ansible_user: ansiblerunner
ansible_port: 222
port: 222
docker_dir: /opt/docker-privfrontends
ansible_become: true # Run everything as root
caddy_extras_config: templates/1-extras.Caddyfile
country: Luxembourg
@ -51,6 +56,7 @@ all:
ansible_port: 22
port: 22
ansible_become: true # Run everything as root
docker_dir: /opt/docker-privfrontends
caddy_extras_config: templates/2-extras.Caddyfile
country: United States
isp: Digital Ocean
@ -62,6 +68,7 @@ all:
ansible_port: 22
port: 22
ansible_become: true # Run everything as root
docker_dir: /opt/docker-privfrontends
caddy_extras_config: templates/3-extras.Caddyfile
country: India
isp: Bharti Airtel

View File

@ -1,7 +1,7 @@
---
- name: Create directory for service
ansible.builtin.file:
path: /opt/docker/{{ item }}
path: {{docker_dir}}/{{ item }}
state: directory
mode: "0755"
tags: docker
@ -9,7 +9,7 @@
- name: Copy docker-compose templates for the service
ansible.builtin.template:
src: ./compose/{{ item }}/compose.yml.j2
dest: /opt/docker/{{ item }}/compose.yml
dest: {{docker_dir}}/{{ item }}/compose.yml
backup: true
mode: preserve
register: check_status
@ -25,7 +25,7 @@
- name: Copy extras file
ansible.builtin.template:
src: ./compose/{{ item }}/extras.conf.j2
dest: /opt/docker/{{ item }}/extras.conf
dest: {{docker_dir}}/{{ item }}/extras.conf
backup: true
mode: preserve
when: file.stat.exists
@ -33,21 +33,21 @@
- name: "Update docker service image"
ansible.builtin.command:
chdir: "/opt/docker/{{ item }}"
chdir: "{{docker_dir}}/{{ item }}"
cmd: docker compose pull
when: check_status.changed
tags: docker
- name: "Stop docker service"
ansible.builtin.command:
chdir: "/opt/docker/{{ item }}"
chdir: "{{docker_dir}}/{{ item }}"
cmd: docker compose down
when: check_status.changed
tags: docker
- name: "Start docker service"
ansible.builtin.command:
chdir: "/opt/docker/{{ item }}"
chdir: "{{docker_dir}}/{{ item }}"
cmd: docker compose up -d --build --remove-orphans
when: check_status.changed
tags: docker

View File

@ -1,10 +1,39 @@
$ANSIBLE_VAULT;1.1;AES256
64633932333563646561656563363431393834393739343364323638653835376262303833396165
3837323964306264333936336236633064393131626532320a343832376539353235653433386138
66653139353635393631636261646265353565643564663139316334386439646162343766613666
3332323135643836320a613234393233656138316232396262393562353230326664653537333839
39396161306238363931313633396263316661383163313436323362346133653935643935636534
61646463313934663230383838323064646635633163313731396330326631643431383837303563
34303965643438626338633763323638633731616637393632643930346534366364643531343538
63363161383038316438666236343566376131623832626334653239643535656535303735643665
38643264383032633835323764383638303166386566393165663537393232613636
66363332323239613534666139626138646536326232313666336635616562616162656561643739
3731613361633338636264323832616333363561373836340a363065313866343036363538316264
35373334393964343561353066623931353230313338303465383033623031643431646338663863
3961663534333666340a326231383037346631346339663037303730653331663531663663303834
36353534633437313036396532356332626235653635303435653538396635383236663734333136
62663563663064333537376333646130613537323138333831643961323862336435363861633031
31363065346235666563613463356231616262303130323962393264393166306238383265653631
63386539623935336237373037643035623930313232303130383732303262316662363065346633
63393136376131613630396263343830653334656535386139303135656437333533646266346330
64313934616234333239353237343736323738633031336435396336653239626462383461666365
34376665326231353531666639623239633735633934383761613465613835323136316339643665
34343539356339306134386665633937353138356461343233363835303032636438383731616261
64333631333563303838393133316566633038353032623765333430313531396361396530633266
65343964636664346630663332326539373235316165386139333264666431366436373963646633
61646538643130616666383530303666633665666261376235373939393833633638383137343533
63643338616139326166353231323865636162653234636366666230373730663266653738656365
64383037643562633538353331383665326666306663333539353261633030633465623866643532
36393361356536643036316633383364366233613032653231333636643536313564303235353231
65613433306164663961653865616662353639346465386466356531353635656163373039303964
66306230376161373861356562643663323634373636366366626465343032313439366366343362
63636630333437653835663038663738316462653431333865373463353235363261636561626236
33653435303634626166633234386561313662666535396562353633656135383932303363663830
37323732626339396433316364343833363261646632316634613331613362653535613337633364
33353535303537666637336337663530636461346632633932643362316230316139633566616465
63643530636530323839623531376166633035343865393530376134616465363633633739393134
33623762643430326233343463346132663134383738336165333561313530633664663966303962
63396431643762623533353261373638313230373363633339643737623136646661653532393134
64393439336163363430663535656439353933356436663630363234393165303938366535313534
66623231376461333565613436333930323038336438353931363663386332366434636134356339
38383563363166663634643666356265363231303431663763363764323665666565646238386539
37636566333036383533623034306332666661393233613538626261616137616430653164373462
62633935646231653037353062363830383530376234366334663938366539353935633962393963
38643435643632343266333439313535386634353663316263333734373839663432346437323361
35326265613134393931656130303432353664643364656233363334383762333632613662653461
33313131363434343563633638336365623162363534363933373533346130386130343639643534
61343261626239353838633638306430303536323931636566643236333338303966623934376466
64633266383631663030653637653161613934636135383339323462663237356137343839653635
6462613966346234363839316134373962316564313462363935