execute tasks as user mastodon

This commit is contained in:
rene
2022-03-18 17:01:33 +01:00
parent 7427614056
commit 1fafdad7a3
3 changed files with 105 additions and 119 deletions

View File

@@ -17,9 +17,5 @@
- include_tasks: system_setup/nginx.yml - include_tasks: system_setup/nginx.yml
- include_tasks: system_setup/user.yml - include_tasks: system_setup/user.yml
- include_tasks: system_setup/ruby.yml - include_tasks: system_setup/ruby.yml
become: true
become_user: "{{ mastodon_user }}"
- include_tasks: system_setup/mastodon.yml - include_tasks: system_setup/mastodon.yml
become: true
become_user: "{{ mastodon_user }}"
- include_tasks: system_setup/letsencrypt.yml - include_tasks: system_setup/letsencrypt.yml

View File

@@ -1,3 +1,7 @@
- block:
become: true
become_user: "{{ mastodon_user }}"
- name: Clone mastodon - name: Clone mastodon
git: git:
repo: "https://github.com/mastodon/mastodon.git" repo: "https://github.com/mastodon/mastodon.git"
@@ -5,7 +9,7 @@
clone: true clone: true
# - name: Update to latest version # - name: Update to latest version
# shell: "git fetch; git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)" # shell: "git fetch; git checkout $(git tag -l | grep -v 'rc[1-9]*$' | sort -V | tail -n 1)"
# args: # args:
# chdir: "{{ mastodon_home }}/{{ mastodon_path }}" # chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
@@ -23,27 +27,6 @@
args: args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}" chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
- name: Install systemd sidekiq Service Files
template:
src: mastodon-sidekiq.service.j2
dest: /etc/systemd/system/mastodon-sidekiq.service
become: true
become_user: root
- name: Install systemd web Service Files
template:
src: mastodon-web.service.j2
dest: /etc/systemd/system/mastodon-web.service
become: true
become_user: root
- name: Install systemd streaming Service Files
template:
src: mastodon-streaming.service.j2
dest: /etc/systemd/system/mastodon-streaming.service
become: true
become_user: root
- name: Media cleanup cronjob - name: Media cleanup cronjob
cron: cron:
name: "media cleanup" name: "media cleanup"
@@ -66,35 +49,38 @@
chdir: "{{ mastodon_home }}/{{ mastodon_path }}" chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
when: production_config.stat.exists when: production_config.stat.exists
- name: Install systemd sidekiq Service Files
template:
src: mastodon-sidekiq.service.j2
dest: /etc/systemd/system/mastodon-sidekiq.service
- name: Install systemd web Service Files
template:
src: mastodon-web.service.j2
dest: /etc/systemd/system/mastodon-web.service
- name: Install systemd streaming Service Files
template:
src: mastodon-streaming.service.j2
dest: /etc/systemd/system/mastodon-streaming.service
- name: Enable mastodon-web - name: Enable mastodon-web
command: systemctl enable mastodon-web.service command: systemctl enable mastodon-web.service
become: true
become_user: root
- name: Enable mastodon-streaming - name: Enable mastodon-streaming
command: systemctl enable mastodon-streaming.service command: systemctl enable mastodon-streaming.service
become: true
become_user: root
- name: Enable mastodon-sidekiq - name: Enable mastodon-sidekiq
command: systemctl enable mastodon-sidekiq.service command: systemctl enable mastodon-sidekiq.service
become: true
become_user: root
- name: Restart mastodon-web - name: Restart mastodon-web
command: systemctl restart mastodon-web.service command: systemctl restart mastodon-web.service
when: production_config.stat.exists when: production_config.stat.exists
become: true
become_user: root
- name: Restart mastodon-streaming - name: Restart mastodon-streaming
command: systemctl restart mastodon-streaming.service command: systemctl restart mastodon-streaming.service
when: production_config.stat.exists when: production_config.stat.exists
become: true
become_user: root
- name: Restart mastodon-sidekiq - name: Restart mastodon-sidekiq
command: systemctl restart mastodon-sidekiq.service command: systemctl restart mastodon-sidekiq.service
when: production_config.stat.exists when: production_config.stat.exists
become: true
become_user: root

View File

@@ -1,4 +1,8 @@
--- ---
- block:
become: true
become_user: "{{ mastodon_user }}"
- name: mastodon | Clone rbenv - name: mastodon | Clone rbenv
git: git:
repo: "https://github.com/rbenv/rbenv.git" repo: "https://github.com/rbenv/rbenv.git"