--- - 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 - Clean cache yarn - NPM Cache clean