From a7a925edb2c7fb66e0d874a09f0f631f32a270dc Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 12 Oct 2024 12:30:02 +0200 Subject: [PATCH] add ghost config --- playbooks/apps/all.yaml | 1 + playbooks/apps/ghost-config.yaml | 80 +++++++++++++++++++ .../ghost-config/gabnotes-org-config.json.j2 | 46 +++++++++++ .../voyages-coccomagnard-fr-config.json.j2 | 40 ++++++++++ .../voyages-lois-augendre-info-config.json.j2 | 40 ++++++++++ 5 files changed, 207 insertions(+) create mode 100644 playbooks/apps/ghost-config.yaml create mode 100644 playbooks/apps/templates/ghost-config/gabnotes-org-config.json.j2 create mode 100644 playbooks/apps/templates/ghost-config/voyages-coccomagnard-fr-config.json.j2 create mode 100644 playbooks/apps/templates/ghost-config/voyages-lois-augendre-info-config.json.j2 diff --git a/playbooks/apps/all.yaml b/playbooks/apps/all.yaml index e867308..d294b43 100644 --- a/playbooks/apps/all.yaml +++ b/playbooks/apps/all.yaml @@ -6,6 +6,7 @@ - import_playbook: code.yaml # noqa: name[play] - import_playbook: collabora.yaml # noqa: name[play] - import_playbook: display.yaml # noqa: name[play] +- import_playbook: ghost-config.yaml # noqa: name[play] - import_playbook: ghost-update.yaml # noqa: name[play] - import_playbook: gitea.yaml # noqa: name[play] - import_playbook: goatcounter.yaml # noqa: name[play] diff --git a/playbooks/apps/ghost-config.yaml b/playbooks/apps/ghost-config.yaml new file mode 100644 index 0000000..ec1b608 --- /dev/null +++ b/playbooks/apps/ghost-config.yaml @@ -0,0 +1,80 @@ +--- +- name: Ghost config + hosts: servers + gather_facts: false + tasks: + - name: Write config files + ansible.builtin.template: + src: templates/ghost-config/{{ item.filename }} + dest: /mnt/data/{{ item.site }}/config.production.json + mode: "0664" + notify: + - Restart service + loop_control: + label: "{{ item.site }}" + loop: + - filename: gabnotes-org-config.json.j2 + site: gabnotes.org + db_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 66306233626430393737653333313461666665363936376465623137656561356431373666363032 + 6537313234336331626464336434343462623264633463330a353165396163653666636333633537 + 33353464393836623861633238663336336465326435613638613734613433386537663635666332 + 6338343039393737310a356335666632303062353336613364323165633239323032346239376262 + 32323862393264326162383761653163353731363331326337633461643364373936 + mail_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 61313164316335333431656136326636353535643363623665326565303961356234353362646261 + 3339616561643434376163613962366631303863313263310a323330316230333864636232386632 + 36363966303861396161373031343865323639383634323131633761666137663766353165333265 + 3630333962383338650a326166383635636533656363613865323065396537396664663132303766 + 62346530353634383935303031343737326335326361313765393664613236356364313161373834 + 35396435303337643330393266376139616164613730643037303039633337343262303335616366 + 373032363533393263323835363666623966 + - filename: voyages-coccomagnard-fr-config.json.j2 + site: voyages.coccomagnard.fr + db_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 33623632396330303536366136313438623138366231333063613539303538303761386264623239 + 3266366633343936356564636131303939636330336335390a313430346536666239656562393238 + 32373533373663656435306239643638313937623631366262393462306138323061333961363938 + 3239373062613138660a393933393436633166303837303263356232336666386336346366373934 + 38346330616639646666616161613865643461643965333237353936663933336533 + mail_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 33386530613164633962393133316231613664623761336237353335336430313637356430306430 + 3837373934336361636461343338643737653839396336340a633130613038666534653865303338 + 64343366663330653737653638326263383836343762386332346339366465363966346432333631 + 6665396333303462620a636335663266316566636536613630313336636463646430333935373965 + 62653636613263303066333833623637653532663939656339376636356261666235656562336661 + 36376233386235393164363064373733623330306362343039623465303134313434366433383863 + 656136646536333065616631336235623430 + - filename: voyages-lois-augendre-info-config.json.j2 + site: voyages-lois.augendre.info + db_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 30623130336131633738353931653239623133326265363862353530303232633333383462663330 + 3935333936383663326162653864623630396363666131390a393532336531663262616431396165 + 33303236363739636665616636326262336532623234666263363563633962343734613565373031 + 3139313038663432370a623363366436643862343734393334306162376634366637616536303035 + 32653739373732613930376336636332343333643436633261616561633034623566 + mail_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 35353737376566653462393530613034353763643166626432613836663638636562303762343133 + 6132313762353565646531613336663336313765623430310a616438613433333632343933373330 + 62356661626437306265313061636634613263613633353433653330653862633639376462353637 + 3739313432356262330a626432386536663638646539323861356564616436386464366333303564 + 35303230623365636362323733623531343335376361313430373936663836353132643834643664 + 6163326436323961636462616430366364626532323861656436 + register: config_files + + handlers: + - name: Restart service + ansible.builtin.command: + cmd: ghost restart + chdir: /mnt/data/{{ item.item.site }} + when: item.changed + changed_when: true + loop: "{{ config_files.results }}" + loop_control: + label: "{{ item.item.site }}" diff --git a/playbooks/apps/templates/ghost-config/gabnotes-org-config.json.j2 b/playbooks/apps/templates/ghost-config/gabnotes-org-config.json.j2 new file mode 100644 index 0000000..a6f05d3 --- /dev/null +++ b/playbooks/apps/templates/ghost-config/gabnotes-org-config.json.j2 @@ -0,0 +1,46 @@ +{ + "url": "https://gabnotes.org", + "admin": { + "url": "https://ghost.augendre.info" + }, + "server": { + "port": 2368, + "host": "0.0.0.0" + }, + "database": { + "client": "mysql", + "connection": { + "host": "127.0.0.1", + "user": "ghost-900", + "password": "{{ item.db_password }}", + "database": "gabnotes_org_prod" + } + }, + "mail": { + "transport": "SMTP", + "from": "blog@mg.gabnotes.org", + "options": { + "service": "Mailgun", + "host": "smtp.eu.mailgun.org", + "port": 465, + "secure": true, + "auth": { + "user": "blog@mg.gabnotes.org", + "pass": "{{ item.mail_password }}" + } + } + }, + "logging": { + "transports": [ + "file", + "stdout" + ] + }, + "process": "systemd", + "paths": { + "contentPath": "/mnt/data/gabnotes.org/content" + }, + "privacy": { + "useGravatar": false + } +} diff --git a/playbooks/apps/templates/ghost-config/voyages-coccomagnard-fr-config.json.j2 b/playbooks/apps/templates/ghost-config/voyages-coccomagnard-fr-config.json.j2 new file mode 100644 index 0000000..17bca3f --- /dev/null +++ b/playbooks/apps/templates/ghost-config/voyages-coccomagnard-fr-config.json.j2 @@ -0,0 +1,40 @@ +{ + "url": "https://voyages.coccomagnard.fr/", + "server": { + "port": 2370, + "host": "0.0.0.0" + }, + "database": { + "client": "mysql", + "connection": { + "host": "127.0.0.1", + "user": "ghost-310", + "password": "{{ item.db_password }}", + "database": "voyages_coccomagnard_fr_prod" + } + }, + "mail": { + "transport": "SMTP", + "from": "voyages@mg.coccomagnard.fr", + "options": { + "service": "Mailgun", + "host": "smtp.eu.mailgun.org", + "port": 465, + "secure": true, + "auth": { + "user": "voyages@mg.coccomagnard.fr", + "pass": "{{ item.mail_password }}" + } + } + }, + "logging": { + "transports": [ + "file", + "stdout" + ] + }, + "process": "systemd", + "paths": { + "contentPath": "/mnt/data/voyages.coccomagnard.fr/content" + } +} diff --git a/playbooks/apps/templates/ghost-config/voyages-lois-augendre-info-config.json.j2 b/playbooks/apps/templates/ghost-config/voyages-lois-augendre-info-config.json.j2 new file mode 100644 index 0000000..fd27446 --- /dev/null +++ b/playbooks/apps/templates/ghost-config/voyages-lois-augendre-info-config.json.j2 @@ -0,0 +1,40 @@ +{ + "url": "https://voyages-lois.augendre.info", + "server": { + "port": 2369, + "host": "0.0.0.0" + }, + "database": { + "client": "mysql", + "connection": { + "host": "127.0.0.1", + "user": "ghost-483", + "password": "{{ item.db_password }}", + "database": "voyages_lois_augendre_info_prod" + } + }, + "mail": { + "transport": "SMTP", + "from": "voyages-lois@mg.augendre.info", + "options": { + "service": "Mailgun", + "host": "smtp.mailgun.org", + "port": 465, + "secure": true, + "auth": { + "user": "voyages-lois@mg.augendre.info", + "pass": "{{ item.mail_password }}" + } + } + }, + "logging": { + "transports": [ + "file", + "stdout" + ] + }, + "process": "systemd", + "paths": { + "contentPath": "/mnt/data/voyages-lois.augendre.info/content" + } +}