writefreely/tasks/main.yaml
changeset 26 b0e4ad2f4291
parent 18 ea20908c3904
child 27 8fddefdd948b
equal deleted inserted replaced
25:b4e52ddd1210 26:b0e4ad2f4291
    21     dest: "/usr/local/bin/"
    21     dest: "/usr/local/bin/"
    22     remote_src: yes
    22     remote_src: yes
    23     owner: "{{writefreely_user}}"
    23     owner: "{{writefreely_user}}"
    24     group: "{{writefreely_user}}"
    24     group: "{{writefreely_user}}"
    25     mode: "0755"
    25     mode: "0755"
       
    26   notify: migrate db
    26 
    27 
    27 - name: create root dir
    28 - name: create root dir
    28   become: yes
    29   become: yes
    29   file:
    30   file:
    30     path: "{{writefreely_dir}}"
    31     path: "{{writefreely_dir}}"
    62     mode: "0644"
    63     mode: "0644"
    63     owner: "{{writefreely_user}}"
    64     owner: "{{writefreely_user}}"
    64     group: "{{writefreely_user}}"
    65     group: "{{writefreely_user}}"
    65   notify: reload service
    66   notify: reload service
    66 
    67 
       
    68 - name: check if keys exists
       
    69   stat:
       
    70     path: "{{writefreely_dir}}/{{writefreely_instance}}/keys/cookies_auth.aes256"
       
    71   register: keys_file
       
    72 
    67 - name: generate keys
    73 - name: generate keys
    68   become: yes
    74   become: yes
    69   become_user: "{{writefreely_user}}"
    75   become_user: "{{writefreely_user}}"
    70   command: "writefreely keys gen"
    76   command: "writefreely keys gen"
    71   args:
    77   args:
    72     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
    78     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
       
    79   when: not key_file.stat.exists
    73 
    80 
    74 - name: check if db exists
    81 - name: check if db exists
    75   stat:
    82   stat:
    76     path: "{{writefreely_dir}}/{{writefreely_instance}}/writefreely.db"
    83     path: "{{writefreely_dir}}/{{writefreely_instance}}/writefreely.db"
    77   register: db_file
    84   register: db_file
    90   command: "writefreely --create-admin admin:admin"
    97   command: "writefreely --create-admin admin:admin"
    91   args:
    98   args:
    92     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
    99     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
    93   when: not db_file.stat.exists
   100   when: not db_file.stat.exists
    94 
   101 
    95 - name: migrate db
       
    96   become: yes
       
    97   become_user: "{{writefreely_user}}"
       
    98   command: "writefreely db migrate"
       
    99   args:
       
   100     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
       
   101   when: db_file.stat.exists
       
   102 
       
   103 - name: install systemd service
   102 - name: install systemd service
   104   become: yes
   103   become: yes
   105   template:
   104   template:
   106     src: "[email protected]"
   105     src: "[email protected]"
   107     dest: "/lib/systemd/system/[email protected]"
   106     dest: "/lib/systemd/system/[email protected]"