Improve Ghost installation
parent
cc7b480a5c
commit
4012495646
@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: "Restart service"
|
||||
systemd:
|
||||
name: "{{ item.name }}.service"
|
||||
state: restarted
|
||||
loop: "{{ ghost }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: "Config ghost"
|
||||
template:
|
||||
src: "config.production.json.j2"
|
||||
dest: "{{ item.home }}/www/config.production.json"
|
||||
owner: "{{ item.account }}"
|
||||
group: "{{ item.account }}"
|
||||
loop: "{{ ghost }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- configure
|
||||
notify:
|
||||
- Restart service
|
@ -0,0 +1,73 @@
|
||||
---
|
||||
- name: "Add ghost user"
|
||||
user:
|
||||
name: "{{ item.account }}"
|
||||
shell: "/bin/false"
|
||||
home: "{{ item.home }}"
|
||||
loop: "{{ ghost }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: "Add www directory"
|
||||
file:
|
||||
path: "{{ item.home }}/www"
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: "{{ item.account }}"
|
||||
group: "{{ item.account }}"
|
||||
loop: "{{ ghost }}"
|
||||
become: yes
|
||||
become_user : "{{ item.account }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: "Install ghost-cli"
|
||||
ansible.builtin.shell: /usr/bin/npm install ghost-cli
|
||||
args:
|
||||
chdir: "{{ item.home }}"
|
||||
loop: "{{ ghost }}"
|
||||
become: yes
|
||||
become_user : "{{ item.account }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: "Install Ghost"
|
||||
ansible.builtin.shell: "{{ item.home }}/node_modules/.bin/ghost install {{ version | default('') }} --dir www --no-prompt --no-setup --no-stack --db mysql --dbhost 192.168.1.254"
|
||||
args:
|
||||
chdir: "{{ item.home }}"
|
||||
loop: "{{ ghost }}"
|
||||
become: yes
|
||||
become_user : "{{ item.account }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
notify:
|
||||
- Restart service
|
||||
|
||||
- name: "Config daemon"
|
||||
template:
|
||||
src: "systemd.service.j2"
|
||||
dest: "/etc/systemd/system/{{ item.name }}.service"
|
||||
loop: "{{ ghost }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: "Reload systemctl"
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: "Enable service"
|
||||
systemd:
|
||||
name: "{{ item.name }}.service"
|
||||
enabled: yes
|
||||
loop: "{{ ghost }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- install
|
||||
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: "Update Ghost"
|
||||
ansible.builtin.shell: "{{ item.home }}/node_modules/.bin/ghost update {{ version | default('') }} --dir www --no-prompt "
|
||||
args:
|
||||
chdir: "{{ item.home }}"
|
||||
loop: "{{ ghost }}"
|
||||
become: yes
|
||||
become_user : "{{ item.account }}"
|
||||
when: ghost_deploy_site in item.name
|
||||
tags:
|
||||
- update
|
||||
notify:
|
||||
- Restart service
|
Loading…
Reference in New Issue