fix: podman connect
This commit is contained in:
+13
-10
@@ -11,7 +11,7 @@
|
||||
|
||||
- name: Create ntfy project directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ podman_projects_dir }}/ntfy"
|
||||
path: "{{ podman_projects_dir | default('/opt/podman') }}/ntfy"
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
@@ -31,16 +31,16 @@
|
||||
- name: Deploy ntfy server configuration
|
||||
ansible.builtin.template:
|
||||
src: server.yml.j2
|
||||
dest: "{{ podman_projects_dir }}/ntfy/server.yml"
|
||||
dest: "{{ podman_projects_dir | default('/opt/podman') }}/ntfy/server.yml"
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0644"
|
||||
notify: Restart ntfy
|
||||
|
||||
- name: Deploy docker-compose.yml for ntfy
|
||||
- name: Deploy Kubernetes YAML for ntfy
|
||||
ansible.builtin.template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ podman_projects_dir }}/ntfy/docker-compose.yml"
|
||||
src: ntfy.yaml.j2
|
||||
dest: "{{ podman_projects_dir | default('/opt/podman') }}/ntfy/ntfy.yaml"
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0644"
|
||||
@@ -70,28 +70,31 @@
|
||||
|
||||
- name: Check if admin user already exists
|
||||
ansible.builtin.command:
|
||||
cmd: podman exec ntfy ntfy user list
|
||||
cmd: podman exec ntfy-server ntfy user list
|
||||
register: ntfy_user_list
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Create admin user in ntfy
|
||||
ansible.builtin.shell: |
|
||||
printf '%s\n%s\n' '{{ ntfy_admin_password }}' '{{ ntfy_admin_password }}' | podman exec -i ntfy ntfy user add --role=admin {{ ntfy_admin_user }}
|
||||
printf '%s\n%s\n' '{{ ntfy_admin_password }}' '{{ ntfy_admin_password }}' | podman exec -i ntfy-server ntfy user add --role=admin {{ ntfy_admin_user }}
|
||||
when: ntfy_admin_user not in ntfy_user_list.stdout
|
||||
register: ntfy_user_create
|
||||
changed_when: ntfy_user_create.rc == 0
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Set admin user password
|
||||
ansible.builtin.shell: |
|
||||
printf '%s\n%s\n' '{{ ntfy_admin_password }}' '{{ ntfy_admin_password }}' | podman exec -i ntfy ntfy user change-pass {{ ntfy_admin_user }}
|
||||
printf '%s\n%s\n' '{{ ntfy_admin_password }}' '{{ ntfy_admin_password }}' | podman exec -i ntfy-server ntfy user change-pass {{ ntfy_admin_user }}
|
||||
when: ntfy_admin_user in ntfy_user_list.stdout
|
||||
changed_when: false
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Deploy nginx vhost configuration for ntfy
|
||||
ansible.builtin.template:
|
||||
src: nginx-vhost.conf.j2
|
||||
dest: "{{ nginx_conf_dir }}/ntfy.conf"
|
||||
dest: "{{ nginx_conf_dir | default('/etc/nginx/conf.d') }}/ntfy.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
@@ -100,7 +103,7 @@
|
||||
|
||||
- name: Remove nginx vhost configuration for ntfy
|
||||
ansible.builtin.file:
|
||||
path: "{{ nginx_conf_dir }}/ntfy.conf"
|
||||
path: "{{ nginx_conf_dir | default('/etc/nginx/conf.d') }}/ntfy.conf"
|
||||
state: absent
|
||||
when: not ntfy_nginx_enabled
|
||||
notify: Reload nginx
|
||||
|
||||
Reference in New Issue
Block a user