mirror of
https://github.com/Crocmagnon/ansible.git
synced 2024-11-23 07:48:04 +01:00
This commit is contained in:
parent
f385090052
commit
96585b08f3
11 changed files with 100 additions and 85 deletions
|
@ -18,7 +18,7 @@
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- templates/bin/*.j2
|
- templates/bin/*.j2
|
||||||
vars:
|
vars:
|
||||||
ghost_db_password: !vault |
|
ghost_setup_db_password: !vault |
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
35343430343439653064613033383830396264306538376535346637613166376663393062353132
|
35343430343439653064613033383830396264306538376535346637613166376663393062353132
|
||||||
6537386534656239333731313938653539643165323532380a336162663839303339623266383662
|
6537386534656239333731313938653539643165323532380a336162663839303339623266383662
|
||||||
|
|
|
@ -3,78 +3,68 @@
|
||||||
hosts: servers
|
hosts: servers
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
- name: Write config files
|
- name: Setup ghost gabnotes.org
|
||||||
ansible.builtin.template:
|
ansible.builtin.include_role:
|
||||||
src: templates/ghost-config/{{ item.filename }}
|
name: ghost_setup
|
||||||
dest: /mnt/data/{{ item.site }}/config.production.json
|
vars:
|
||||||
mode: "0664"
|
ghost_setup_filename: gabnotes-org-config.json.j2
|
||||||
notify:
|
ghost_setup_site: gabnotes.org
|
||||||
- Restart service
|
ghost_setup_db_password: !vault |
|
||||||
loop_control:
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
label: "{{ item.site }}"
|
66306233626430393737653333313461666665363936376465623137656561356431373666363032
|
||||||
loop:
|
6537313234336331626464336434343462623264633463330a353165396163653666636333633537
|
||||||
- filename: gabnotes-org-config.json.j2
|
33353464393836623861633238663336336465326435613638613734613433386537663635666332
|
||||||
site: gabnotes.org
|
6338343039393737310a356335666632303062353336613364323165633239323032346239376262
|
||||||
db_password: !vault |
|
32323862393264326162383761653163353731363331326337633461643364373936
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
ghost_setup_mail_password: !vault |
|
||||||
66306233626430393737653333313461666665363936376465623137656561356431373666363032
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
6537313234336331626464336434343462623264633463330a353165396163653666636333633537
|
61313164316335333431656136326636353535643363623665326565303961356234353362646261
|
||||||
33353464393836623861633238663336336465326435613638613734613433386537663635666332
|
3339616561643434376163613962366631303863313263310a323330316230333864636232386632
|
||||||
6338343039393737310a356335666632303062353336613364323165633239323032346239376262
|
36363966303861396161373031343865323639383634323131633761666137663766353165333265
|
||||||
32323862393264326162383761653163353731363331326337633461643364373936
|
3630333962383338650a326166383635636533656363613865323065396537396664663132303766
|
||||||
mail_password: !vault |
|
62346530353634383935303031343737326335326361313765393664613236356364313161373834
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
35396435303337643330393266376139616164613730643037303039633337343262303335616366
|
||||||
61313164316335333431656136326636353535643363623665326565303961356234353362646261
|
373032363533393263323835363666623966
|
||||||
3339616561643434376163613962366631303863313263310a323330316230333864636232386632
|
- name: Setup ghost voyages.coccomagnard.fr
|
||||||
36363966303861396161373031343865323639383634323131633761666137663766353165333265
|
ansible.builtin.include_role:
|
||||||
3630333962383338650a326166383635636533656363613865323065396537396664663132303766
|
name: ghost_setup
|
||||||
62346530353634383935303031343737326335326361313765393664613236356364313161373834
|
vars:
|
||||||
35396435303337643330393266376139616164613730643037303039633337343262303335616366
|
ghost_setup_filename: voyages-coccomagnard-fr-config.json.j2
|
||||||
373032363533393263323835363666623966
|
ghost_setup_site: voyages.coccomagnard.fr
|
||||||
- filename: voyages-coccomagnard-fr-config.json.j2
|
ghost_setup_db_password: !vault |
|
||||||
site: voyages.coccomagnard.fr
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
db_password: !vault |
|
33623632396330303536366136313438623138366231333063613539303538303761386264623239
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
3266366633343936356564636131303939636330336335390a313430346536666239656562393238
|
||||||
33623632396330303536366136313438623138366231333063613539303538303761386264623239
|
32373533373663656435306239643638313937623631366262393462306138323061333961363938
|
||||||
3266366633343936356564636131303939636330336335390a313430346536666239656562393238
|
3239373062613138660a393933393436633166303837303263356232336666386336346366373934
|
||||||
32373533373663656435306239643638313937623631366262393462306138323061333961363938
|
38346330616639646666616161613865643461643965333237353936663933336533
|
||||||
3239373062613138660a393933393436633166303837303263356232336666386336346366373934
|
ghost_setup_mail_password: !vault |
|
||||||
38346330616639646666616161613865643461643965333237353936663933336533
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
mail_password: !vault |
|
33386530613164633962393133316231613664623761336237353335336430313637356430306430
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
3837373934336361636461343338643737653839396336340a633130613038666534653865303338
|
||||||
33386530613164633962393133316231613664623761336237353335336430313637356430306430
|
64343366663330653737653638326263383836343762386332346339366465363966346432333631
|
||||||
3837373934336361636461343338643737653839396336340a633130613038666534653865303338
|
6665396333303462620a636335663266316566636536613630313336636463646430333935373965
|
||||||
64343366663330653737653638326263383836343762386332346339366465363966346432333631
|
62653636613263303066333833623637653532663939656339376636356261666235656562336661
|
||||||
6665396333303462620a636335663266316566636536613630313336636463646430333935373965
|
36376233386235393164363064373733623330306362343039623465303134313434366433383863
|
||||||
62653636613263303066333833623637653532663939656339376636356261666235656562336661
|
656136646536333065616631336235623430
|
||||||
36376233386235393164363064373733623330306362343039623465303134313434366433383863
|
- name: Setup ghost voyages-lois.augendre.info
|
||||||
656136646536333065616631336235623430
|
ansible.builtin.include_role:
|
||||||
- filename: voyages-lois-augendre-info-config.json.j2
|
name: ghost_setup
|
||||||
site: voyages-lois.augendre.info
|
vars:
|
||||||
db_password: !vault |
|
ghost_setup_filename: voyages-lois-augendre-info-config.json.j2
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
ghost_setup_site: voyages-lois.augendre.info
|
||||||
30623130336131633738353931653239623133326265363862353530303232633333383462663330
|
ghost_setup_db_password: !vault |
|
||||||
3935333936383663326162653864623630396363666131390a393532336531663262616431396165
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
33303236363739636665616636326262336532623234666263363563633962343734613565373031
|
30623130336131633738353931653239623133326265363862353530303232633333383462663330
|
||||||
3139313038663432370a623363366436643862343734393334306162376634366637616536303035
|
3935333936383663326162653864623630396363666131390a393532336531663262616431396165
|
||||||
32653739373732613930376336636332343333643436633261616561633034623566
|
33303236363739636665616636326262336532623234666263363563633962343734613565373031
|
||||||
mail_password: !vault |
|
3139313038663432370a623363366436643862343734393334306162376634366637616536303035
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
32653739373732613930376336636332343333643436633261616561633034623566
|
||||||
35353737376566653462393530613034353763643166626432613836663638636562303762343133
|
ghost_setup_mail_password: !vault |
|
||||||
6132313762353565646531613336663336313765623430310a616438613433333632343933373330
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
62356661626437306265313061636634613263613633353433653330653862633639376462353637
|
35353737376566653462393530613034353763643166626432613836663638636562303762343133
|
||||||
3739313432356262330a626432386536663638646539323861356564616436386464366333303564
|
6132313762353565646531613336663336313765623430310a616438613433333632343933373330
|
||||||
35303230623365636362323733623531343335376361313430373936663836353132643834643664
|
62356661626437306265313061636634613263613633353433653330653862633639376462353637
|
||||||
6163326436323961636462616430366364626532323861656436
|
3739313432356262330a626432386536663638646539323861356564616436386464366333303564
|
||||||
register: config_files
|
35303230623365636362323733623531343335376361313430373936663836353132643834643664
|
||||||
|
6163326436323961636462616430366364626532323861656436
|
||||||
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 }}"
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
/usr/bin/mysqldump --no-tablespaces -u root --password={{ ghost_db_password }} gabnotes_org_prod > /mnt/data/gabnotes.org/db_export/backup.sql
|
/usr/bin/mysqldump --no-tablespaces -u root --password={{ ghost_setup_db_password }} gabnotes_org_prod > /mnt/data/gabnotes.org/db_export/backup.sql
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
/usr/bin/mysqldump --no-tablespaces -u root --password={{ ghost_db_password }} voyages_lois_augendre_info_prod > /mnt/data/voyages-lois.augendre.info/db_export/backup.sql
|
/usr/bin/mysqldump --no-tablespaces -u root --password={{ ghost_setup_db_password }} voyages_lois_augendre_info_prod > /mnt/data/voyages-lois.augendre.info/db_export/backup.sql
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
/usr/bin/mysqldump --no-tablespaces -u root --password={{ ghost_db_password }} voyages_coccomagnard_fr_prod > /mnt/data/voyages.coccomagnard.fr/db_export/backup.sql
|
/usr/bin/mysqldump --no-tablespaces -u root --password={{ ghost_setup_db_password }} voyages_coccomagnard_fr_prod > /mnt/data/voyages.coccomagnard.fr/db_export/backup.sql
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"connection": {
|
"connection": {
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"user": "ghost-900",
|
"user": "ghost-900",
|
||||||
"password": "{{ item.db_password }}",
|
"password": "{{ ghost_setup_db_password }}",
|
||||||
"database": "gabnotes_org_prod"
|
"database": "gabnotes_org_prod"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
"secure": true,
|
"secure": true,
|
||||||
"auth": {
|
"auth": {
|
||||||
"user": "blog@mg.gabnotes.org",
|
"user": "blog@mg.gabnotes.org",
|
||||||
"pass": "{{ item.mail_password }}"
|
"pass": "{{ ghost_setup_mail_password }}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"connection": {
|
"connection": {
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"user": "ghost-310",
|
"user": "ghost-310",
|
||||||
"password": "{{ item.db_password }}",
|
"password": "{{ ghost_setup_db_password }}",
|
||||||
"database": "voyages_coccomagnard_fr_prod"
|
"database": "voyages_coccomagnard_fr_prod"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
"secure": true,
|
"secure": true,
|
||||||
"auth": {
|
"auth": {
|
||||||
"user": "voyages@mg.coccomagnard.fr",
|
"user": "voyages@mg.coccomagnard.fr",
|
||||||
"pass": "{{ item.mail_password }}"
|
"pass": "{{ ghost_setup_mail_password }}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"connection": {
|
"connection": {
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"user": "ghost-483",
|
"user": "ghost-483",
|
||||||
"password": "{{ item.db_password }}",
|
"password": "{{ ghost_setup_db_password }}",
|
||||||
"database": "voyages_lois_augendre_info_prod"
|
"database": "voyages_lois_augendre_info_prod"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
"secure": true,
|
"secure": true,
|
||||||
"auth": {
|
"auth": {
|
||||||
"user": "voyages-lois@mg.augendre.info",
|
"user": "voyages-lois@mg.augendre.info",
|
||||||
"pass": "{{ item.mail_password }}"
|
"pass": "{{ ghost_setup_mail_password }}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
5
roles/ghost_setup/defaults/main.yaml
Normal file
5
roles/ghost_setup/defaults/main.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
ghost_setup_filename: site-com-config.json.j2
|
||||||
|
ghost_setup_site: site.com
|
||||||
|
ghost_setup_db_password: 123
|
||||||
|
ghost_setup_mail_password: 123
|
6
roles/ghost_setup/handlers/main.yaml
Normal file
6
roles/ghost_setup/handlers/main.yaml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Restart service
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: ghost restart
|
||||||
|
chdir: /mnt/data/{{ ghost_setup_site }}
|
||||||
|
changed_when: true
|
14
roles/ghost_setup/tasks/main.yaml
Normal file
14
roles/ghost_setup/tasks/main.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
- name: Write config files
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: templates/ghost-config/{{ ghost_setup_filename }}
|
||||||
|
dest: /mnt/data/{{ ghost_setup_site }}/config.production.json
|
||||||
|
mode: "0664"
|
||||||
|
notify:
|
||||||
|
- Restart service
|
||||||
|
- name: Ensure service is started
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: ghost start
|
||||||
|
chdir: /mnt/data/{{ ghost_setup_site }}
|
||||||
|
register: start
|
||||||
|
changed_when: '"Starting Ghost" in start.stdout'
|
Loading…
Reference in a new issue