74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
---
|
|
- 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
|
|
|