writefreely/server/tasks/main.yaml
changeset 171 534b247bed1c
parent 170 a20a6d03747f
child 172 21cfe5ba8d13
equal deleted inserted replaced
170:a20a6d03747f 171:534b247bed1c
    21     dest: "/usr/local/bin/"
    21     dest: "/usr/local/bin/"
    22     remote_src: yes
    22     remote_src: yes
    23     owner: "root"
    23     owner: "root"
    24     group: "root"
    24     group: "root"
    25     mode: "0755"
    25     mode: "0755"
    26   notify: migrate db
    26   notify:
       
    27     - migrate db
       
    28     - restart service
    27 
    29 
    28 - name: create instance dir
    30 - name: create instance dir
    29   become: yes
    31   become: yes
    30   file:
    32   file:
    31     path: "{{item}}"
    33     path: "{{item}}"
    32     state: "directory"
    34     state: "directory"
    33     owner: "{{writefreely_user}}"
    35     owner: "{{writefreely_user}}"
    34     group: "{{writefreely_user}}"
    36     group: "{{writefreely_user}}"
    35     mode: "0755"
    37     mode: "0755"
    36   notify: reload service
    38   notify: restart service
    37   loop:
    39   loop:
    38     - "{{writefreely_dir}}"
    40     - "{{writefreely_dir}}"
    39     - "{{writefreely_dir}}/{{writefreely_instance}}"
    41     - "{{writefreely_dir}}/{{writefreely_instance}}"
    40 
    42 
    41 - name: install static content
    43 - name: install static content
    45     remote_src: yes
    47     remote_src: yes
    46     dest: "{{writefreely_dir}}/{{writefreely_instance}}/"
    48     dest: "{{writefreely_dir}}/{{writefreely_instance}}/"
    47     owner: "{{writefreely_user}}"
    49     owner: "{{writefreely_user}}"
    48     group: "{{writefreely_user}}"
    50     group: "{{writefreely_user}}"
    49     mode: "0755"
    51     mode: "0755"
       
    52   notify: restart service
    50 
    53 
    51 - name: configure
    54 - name: configure
    52   become: yes
    55   become: yes
    53   template:
    56   template:
    54     src: "config.ini.j2"
    57     src: "config.ini.j2"
    55     dest: "{{writefreely_dir}}/{{writefreely_instance}}/config.ini"
    58     dest: "{{writefreely_dir}}/{{writefreely_instance}}/config.ini"
    56     mode: "0644"
    59     mode: "0644"
    57     owner: "{{writefreely_user}}"
    60     owner: "{{writefreely_user}}"
    58     group: "{{writefreely_user}}"
    61     group: "{{writefreely_user}}"
    59   notify: reload service
    62   notify: restart service
    60 
       
    61 - name: check if keys exists
       
    62   stat:
       
    63     path: "{{writefreely_dir}}/{{writefreely_instance}}/keys/cookies_auth.aes256"
       
    64   register: keys_file
       
    65 
    63 
    66 - name: generate keys
    64 - name: generate keys
    67   become: yes
    65   become: yes
    68   become_user: "{{writefreely_user}}"
    66   become_user: "{{writefreely_user}}"
    69   command: "writefreely keys generate"
    67   command: "writefreely keys generate"
    70   args:
    68   args:
    71     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
    69     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
    72   # when: not keys_file.stat.exists
    70   chaned_when: false
    73 
    71 
    74 - name: check if db exists
    72 - name: check if db exists
    75   stat:
    73   stat:
    76     path: "{{writefreely_dir}}/{{writefreely_instance}}/writefreely.db"
    74     path: "{{writefreely_dir}}/{{writefreely_instance}}/writefreely.db"
    77   register: db_file
    75   register: db_file
    95 - name: install systemd service
    93 - name: install systemd service
    96   become: yes
    94   become: yes
    97   template:
    95   template:
    98     src: "[email protected]"
    96     src: "[email protected]"
    99     dest: "/lib/systemd/system/[email protected]"
    97     dest: "/lib/systemd/system/[email protected]"
       
    98   notify: reload service
   100 
    99 
   101 - name: ensure service is started
   100 - name: ensure service is started
   102   become: yes
   101   become: yes
   103   systemd: name="writefreely@{{writefreely_instance}}.service" enabled="yes" state="started"
   102   systemd: name="writefreely@{{writefreely_instance}}.service" enabled="yes" state="started"