From 3a492c2f3ecd445c2c0eda284ab771d11f88cdd0 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Wed, 3 Aug 2022 15:45:34 +0100 Subject: [PATCH 01/12] add saucy container --- 02_lxc_containers.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/02_lxc_containers.yaml b/02_lxc_containers.yaml index 96960d0..29fa490 100644 --- a/02_lxc_containers.yaml +++ b/02_lxc_containers.yaml @@ -20,6 +20,7 @@ - { name: haproxy, state: started } - { name: gitea, state: started } - { name: freescout, state: started } + - { name: saucy, state: started } - { name: pretalx, state: stopped } - name: Create haproxy port forwards community.general.lxd_container: From 275bb3cd9e8776e56a42e5a52c2a0d872ac69c08 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Wed, 3 Aug 2022 15:45:45 +0100 Subject: [PATCH 02/12] add saucy host --- hosts | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts b/hosts index 037fadd..4488532 100644 --- a/hosts +++ b/hosts @@ -4,3 +4,4 @@ lxd.ansol.org [containers] haproxy@lxd.ansol.org ansible_connection=sshlxd gitea@lxd.ansol.org ansible_connection=sshlxd +saucy@lxd.ansol.org ansible_connection=sshlxd From 79b0a563be5934a8fffbd31b2b88d26395c73665 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Fri, 5 Aug 2022 09:48:28 +0100 Subject: [PATCH 03/12] adiciona saucy ao haproxy --- files/ha_haproxy.cfg.j2 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/files/ha_haproxy.cfg.j2 b/files/ha_haproxy.cfg.j2 index 10bc673..6915f2b 100644 --- a/files/ha_haproxy.cfg.j2 +++ b/files/ha_haproxy.cfg.j2 @@ -85,6 +85,10 @@ frontend http_https acl listas_ansol hdr(host) -i listas.ansol.org use_backend listas_ansol if listas_ansol + # Saucy + acl saucy hdr(host) -i saucy.ansol.org + use_backend saucy if saucy + # Let's Encrypt backend letsencrypt @@ -109,3 +113,9 @@ backend pretalx backend listas_ansol server listas_ansol kpn0.netureza.pt:80 check + +# Saucy + +backend saucy + server saucy saucy:80 check + From 4f8568f1ba1f77a0c3ccfa1834915f5a9ebca5c2 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Fri, 5 Aug 2022 09:51:34 +0100 Subject: [PATCH 04/12] instala docker no container saucy --- 05_container_saucy.yaml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 05_container_saucy.yaml diff --git a/05_container_saucy.yaml b/05_container_saucy.yaml new file mode 100644 index 0000000..766420e --- /dev/null +++ b/05_container_saucy.yaml @@ -0,0 +1,37 @@ +--- +- name: SAUCY + hosts: saucy@lxd.ansol.org + become: true + tasks: + - name: SAUCY -- install needed packages + become: true + package: + state: present + name: '{{ item }}' + with_items: + - ca-certificates + - curl + - gnupg + - lsb-release + - name: SAUCY -- add Docker GPG key + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + - name: SAUCY -- add Docker repository to apt + apt_repository: + repo: deb https://download.docker.com/linux/ubuntu focal stable + state: present + - name: SAUCY -- install docker + apt: + name: '{{item}}' + state: latest + update_cache: yes + loop: + - docker-ce + - docker-ce-cli + - containerd.io + - name: SAUCY -- start, and enable, docker service + service: + name: docker + state: started + enabled: yes From 26eaea8c018b233dcc5e6abc1d8201d0f3db64ab Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Fri, 12 Aug 2022 19:45:49 +0100 Subject: [PATCH 05/12] prep ansible vault --- .gitignore | 3 +++ ansible.cfg | 1 + 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index c18dd8d..5aba8ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ __pycache__/ + +# ansible vault password +.vault_pass diff --git a/ansible.cfg b/ansible.cfg index 5d5f478..698a0af 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,5 +1,6 @@ [defaults] inventory = hosts +vault_password_file = .vault_pass [connection] pipelining = True From bffc222bb0161933eb91a9b88c6f6c45af0cc967 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Fri, 12 Aug 2022 19:46:13 +0100 Subject: [PATCH 06/12] usa IP do container --- files/ha_haproxy.cfg.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/ha_haproxy.cfg.j2 b/files/ha_haproxy.cfg.j2 index 6915f2b..09db8d1 100644 --- a/files/ha_haproxy.cfg.j2 +++ b/files/ha_haproxy.cfg.j2 @@ -117,5 +117,5 @@ backend listas_ansol # Saucy backend saucy - server saucy saucy:80 check + server saucy 10.81.14.206:80 check From 77088baa9bb25c218b64fb6167309fe238f13128 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Fri, 12 Aug 2022 20:11:31 +0100 Subject: [PATCH 07/12] adiciona containers e tweaks --- 05_container_saucy.yaml | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/05_container_saucy.yaml b/05_container_saucy.yaml index 766420e..e055285 100644 --- a/05_container_saucy.yaml +++ b/05_container_saucy.yaml @@ -13,25 +13,69 @@ - curl - gnupg - lsb-release + - python3-psycopg2 - name: SAUCY -- add Docker GPG key + become: true apt_key: url: https://download.docker.com/linux/ubuntu/gpg state: present - name: SAUCY -- add Docker repository to apt + become: true apt_repository: repo: deb https://download.docker.com/linux/ubuntu focal stable state: present - name: SAUCY -- install docker + become: true apt: name: '{{item}}' state: latest - update_cache: yes loop: - docker-ce - docker-ce-cli - containerd.io + - python3-docker - name: SAUCY -- start, and enable, docker service + become: true service: name: docker state: started enabled: yes + # postgres server and db, account + - name: SAUCY -- install postgresql + become: true + community.docker.docker_container: + name: postgresql + image: postgres:latest + state: started + container_default_behavior: no_defaults + volumes: + - /data:/var/lib/postgresql/data + ports: + - '5432:5432' + env: + POSTGRES_USER: '{{ db_user }}' + POSTGRES_PASSWORD: '{{ db_password }}' + POSTGRES_DB: '{{ db_name }}' + - name: SAUCY -- add Saucy container + community.docker.docker_container: + name: saucy + image: git.ansol.org/ansol/saucy:latest + state: started + container_default_behavior: no_defaults + ports: + - '80:3000' + env: + DATABASE_URL: 'postgres://{{ db_user }}:{{ db_password }}@{{ db_host }}/{{ db_name }}' + SMTP_ADDRESS: smtp.netureza.pt + SMTP_DOMAIN: ansol.org + SMTP_USERNAME: '{{ smtp_username }}' + SMTP_PASSWORD: '{{ smtp_password }}' + SMTP_FROM_ADDRESS: direccao@ansol.org + SMTP_FROM_NAME: ANSOL + + IFTHENPAY_KEY: '{{ ifthenpay_key }}' + IFTHENPAY_ACCOUNTS: '{{ ifthenpay_accounts }}' + + BASE_HOST: saucy.ansol.org + RAILS_LOG_TO_STDOUT: 'true' + RAILS_ENV: production From a4b98e0ac43b47de6f322a885371c49a8b36c5ca Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Fri, 12 Aug 2022 20:11:40 +0100 Subject: [PATCH 08/12] var file --- host_vars/saucy@lxd.ansol.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 host_vars/saucy@lxd.ansol.org diff --git a/host_vars/saucy@lxd.ansol.org b/host_vars/saucy@lxd.ansol.org new file mode 100644 index 0000000..77a6ef0 --- /dev/null +++ b/host_vars/saucy@lxd.ansol.org @@ -0,0 +1,18 @@ +$ANSIBLE_VAULT;1.1;AES256 +31636238333732343966666539656439613537623162353737636561366139313961303734356330 +3933323162373333333362323430373365633432633162340a653261653461653639316638656161 +63663531616632623263626265363263306532623563633565643863306166393664303833653936 +3163663766346633380a316131653532346539353262366432306561336436656464626530356237 +39303539353765383662316566353038373039623166373131323762626263343135323534656562 +37313665386439363965613131396564356130636663613537383965306134623861633161333238 +36633639313635313066313831666137613634623335636234663532623166343232313835386632 +63326565363932396566656537393032353935316663373262373766663265623230336565363562 +65663938646635396235623561353733356330383939653962646662313635313036356561623861 +61373962353464323966383937383466613063383461333338326666363432303161626131643234 +63353730313939623633663533333563323761653534666661613562396430616266346466646336 +35393162386463303831636135303132663235313134386531626234356430326563636366333464 +35613635626563363439333764663935313231663563323931656333313634646336613062636235 +66633761316335613830346265356333656239373661666539636239396130616666623733303138 +39343436303837316266333962396461333438383666616636396637643864643265643435656539 +34323635633565333662313430343362396638373234613036653838616339346433363435326365 +6366 From 5d33a9ad76ac3459b2bc1cd82aba08b7df2c80a7 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Mon, 15 Aug 2022 10:10:07 +0100 Subject: [PATCH 09/12] using container name --- files/ha_haproxy.cfg.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/ha_haproxy.cfg.j2 b/files/ha_haproxy.cfg.j2 index 09db8d1..2b230e0 100644 --- a/files/ha_haproxy.cfg.j2 +++ b/files/ha_haproxy.cfg.j2 @@ -49,6 +49,9 @@ defaults errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http +resolvers localdns + parse-resolv-conf + # The web frontend frontend http_https @@ -117,5 +120,5 @@ backend listas_ansol # Saucy backend saucy - server saucy 10.81.14.206:80 check + server saucy saucy.lxd:80 check resolvers localdns resolve-prefer ipv4 From a63cea077c43c04e5f065971f9976375c9449578 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Mon, 15 Aug 2022 10:28:34 +0100 Subject: [PATCH 10/12] add ifthenpay, still WIP --- host_vars/saucy@lxd.ansol.org | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/host_vars/saucy@lxd.ansol.org b/host_vars/saucy@lxd.ansol.org index 77a6ef0..22a6086 100644 --- a/host_vars/saucy@lxd.ansol.org +++ b/host_vars/saucy@lxd.ansol.org @@ -1,18 +1,18 @@ $ANSIBLE_VAULT;1.1;AES256 -31636238333732343966666539656439613537623162353737636561366139313961303734356330 -3933323162373333333362323430373365633432633162340a653261653461653639316638656161 -63663531616632623263626265363263306532623563633565643863306166393664303833653936 -3163663766346633380a316131653532346539353262366432306561336436656464626530356237 -39303539353765383662316566353038373039623166373131323762626263343135323534656562 -37313665386439363965613131396564356130636663613537383965306134623861633161333238 -36633639313635313066313831666137613634623335636234663532623166343232313835386632 -63326565363932396566656537393032353935316663373262373766663265623230336565363562 -65663938646635396235623561353733356330383939653962646662313635313036356561623861 -61373962353464323966383937383466613063383461333338326666363432303161626131643234 -63353730313939623633663533333563323761653534666661613562396430616266346466646336 -35393162386463303831636135303132663235313134386531626234356430326563636366333464 -35613635626563363439333764663935313231663563323931656333313634646336613062636235 -66633761316335613830346265356333656239373661666539636239396130616666623733303138 -39343436303837316266333962396461333438383666616636396637643864643265643435656539 -34323635633565333662313430343362396638373234613036653838616339346433363435326365 -6366 +36623132353066333133613638303235393630383764346430363536303835663730613164366438 +3961313531613162623534646537386632646366323165310a623064376333613735643439333937 +36656637653038356135353539356431313865383162616135363664653732316632636233626238 +6564333337336438340a313531323039623535656630666137343663363236313464396538633566 +30626661316332356239613835306430646230376236353139623838346638636162333763663030 +37316564346533643065386666656364306535616564646138623934373061343737663436356438 +32653832336561353031306365316339663430623832613237336237653664346462656165303562 +32613763373232383165643634613866653538613665333036666266656437303761646665333634 +66613461353663393562326539633261613865643438643062313866646437303331366561656233 +39633633396339633061653565643534303431613734643134326336613761316137636231666566 +30396266643565646366396439656430346138336530383764343234326131396135373034343431 +63363961353039616330386466643164336566386230306565633335383539613164663665323364 +63356634396366653162633938313636343034666365626333633335323364343564313933653536 +32623631313039656364363563323036363934393631646534306430313132373363653236333532 +38626161623864303233613035633135316432313563386661343761373366363230353033366562 +65316432363564653135333961306233346665376334306439383335656439646639313134326462 +3038 From 154b450e0d5bbd110cdcd3c6f193f3b6dba4f394 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Mon, 15 Aug 2022 10:52:24 +0100 Subject: [PATCH 11/12] completo! --- host_vars/saucy@lxd.ansol.org | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/host_vars/saucy@lxd.ansol.org b/host_vars/saucy@lxd.ansol.org index 22a6086..ce69d58 100644 --- a/host_vars/saucy@lxd.ansol.org +++ b/host_vars/saucy@lxd.ansol.org @@ -1,18 +1,18 @@ $ANSIBLE_VAULT;1.1;AES256 -36623132353066333133613638303235393630383764346430363536303835663730613164366438 -3961313531613162623534646537386632646366323165310a623064376333613735643439333937 -36656637653038356135353539356431313865383162616135363664653732316632636233626238 -6564333337336438340a313531323039623535656630666137343663363236313464396538633566 -30626661316332356239613835306430646230376236353139623838346638636162333763663030 -37316564346533643065386666656364306535616564646138623934373061343737663436356438 -32653832336561353031306365316339663430623832613237336237653664346462656165303562 -32613763373232383165643634613866653538613665333036666266656437303761646665333634 -66613461353663393562326539633261613865643438643062313866646437303331366561656233 -39633633396339633061653565643534303431613734643134326336613761316137636231666566 -30396266643565646366396439656430346138336530383764343234326131396135373034343431 -63363961353039616330386466643164336566386230306565633335383539613164663665323364 -63356634396366653162633938313636343034666365626333633335323364343564313933653536 -32623631313039656364363563323036363934393631646534306430313132373363653236333532 -38626161623864303233613035633135316432313563386661343761373366363230353033366562 -65316432363564653135333961306233346665376334306439383335656439646639313134326462 -3038 +37323635663062383436383061366461326133386235313733653466313565346562373131333031 +3235306530653634333733326430616632393064356330350a363864653566653763383664663061 +30656266383834303464366266366435636438343663313436393764353537326163366434313131 +3565323935396330310a613631623530333365643530313531373039336434366166663338613261 +37316462393330663263636464343865313962343738323537623239316533643831303764623132 +39636337646538386336393366656336333066316337336634356564303533626263313435376435 +36376539383434376430666263316639376337376636616337356161653234393666636461356466 +36366665376632643964386535316538326235666266396631363064613235623639666235396434 +39316636623264366561393032346666343465333565316136636234323962333339313832303634 +37623230313538366666656338666332386431616230343533616234633065356337633766633330 +65626566386632303130393336343736303464326130383964333133656632653236626366376166 +63383363653830346364373966393036316363393863643833386630633535366332343932643639 +38366630326235363033346636316631343532386236613430616165643632636331313832633463 +65336664343336663064383866323635663561306637613439626364366435656131646664353138 +63356631623562633735303636343232333232646439623764303239643730653431626465616363 +35663633303234613064353433646632343436643130336337336361326664336239326135323161 +3738 From a5cc2229719917819d89aff769bd99ae75d1733b Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Sun, 21 Aug 2022 19:12:53 +0100 Subject: [PATCH 12/12] trash! --- 05_container_saucy.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/05_container_saucy.yaml b/05_container_saucy.yaml index e055285..aa51d89 100644 --- a/05_container_saucy.yaml +++ b/05_container_saucy.yaml @@ -13,7 +13,6 @@ - curl - gnupg - lsb-release - - python3-psycopg2 - name: SAUCY -- add Docker GPG key become: true apt_key: