mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-26 12:33:09 +08:00
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
- block:
|
|
- name: Create credentials Folder
|
|
file:
|
|
path: /credentials
|
|
state: directory
|
|
|
|
- name: Create a PHP symbolic link
|
|
file:
|
|
src: "{{installpath}}/{{item}}/.env"
|
|
dest: "/credentials/{{item}}_password.txt"
|
|
state: link
|
|
loop: "{{applist.stdout_lines}}"
|
|
|
|
- name: Copy Init Script
|
|
template:
|
|
src: init.sh.jinja2
|
|
dest: /credentials/init.sh
|
|
mode: 0750
|
|
|
|
- name: Upload init-apps.service
|
|
template:
|
|
src: init-apps.service.jinja2
|
|
dest: /lib/systemd/system/init-apps.service
|
|
|
|
- name: Enable service
|
|
service:
|
|
name: init-apps
|
|
enabled: yes
|
|
|
|
- block:
|
|
- name: Check init, if /credentials/* file not exist or no content, stop and exit Ansible
|
|
shell: |
|
|
[ -s /credentials/password.txt ] && [ -s /credentials/init.sh ] && init_initpasswd=true || init_initpasswd=false
|
|
echo $init_initpasswd
|
|
register: init_check
|
|
|
|
- name: Output error when init.sh fail
|
|
fail: msg="init role is not done,exit!"
|
|
when: init_check.stdout == "false"
|