mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	Update nextcloud_enabled.yml
This commit is contained in:
		
							parent
							
								
									f03eb1300f
								
							
						
					
					
						commit
						5ad953dbd0
					
				
					 1 changed files with 38 additions and 24 deletions
				
			
		| 
						 | 
					@ -13,20 +13,26 @@
 | 
				
			||||||
    mode: 0644
 | 
					    mode: 0644
 | 
				
			||||||
  when: nextcloud_enabled
 | 
					  when: nextcloud_enabled
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Create symlink from sites-available to sites-enabled for http://box/nextcloud (debuntu)
 | 
					- name: Create symlink nextcloud.conf from sites-enabled to sites-available for http://box/nextcloud (debuntu)
 | 
				
			||||||
  file:
 | 
					  file:
 | 
				
			||||||
    src: /etc/apache2/sites-available/nextcloud.conf
 | 
					    src: "/etc/{{ apache_config_dir }}/nextcloud.conf"
 | 
				
			||||||
    path: /etc/apache2/sites-enabled/nextcloud.conf
 | 
					    path: /etc/apache2/sites-enabled/nextcloud.conf
 | 
				
			||||||
    state: link
 | 
					    state: link
 | 
				
			||||||
  when: nextcloud_enabled and is_debuntu
 | 
					  when: nextcloud_enabled and is_debuntu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Remove nextcloud.conf if not nextcloud_enabled (redhat)
 | 
					- name: Remove symlink nextcloud.conf from /etc/apache2/sites-enabled if not nextcloud_enabled (debuntu)
 | 
				
			||||||
 | 
					  file:
 | 
				
			||||||
 | 
					    path: /etc/apache2/sites-enabled/nextcloud.conf
 | 
				
			||||||
 | 
					    state: absent
 | 
				
			||||||
 | 
					  when: not nextcloud_enabled and is_debuntu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Remove sites-available/nextcloud.conf if not nextcloud_enabled (redhat)
 | 
				
			||||||
  file:
 | 
					  file:
 | 
				
			||||||
    path: "/etc/{{ apache_config_dir }}/nextcloud.conf"
 | 
					    path: "/etc/{{ apache_config_dir }}/nextcloud.conf"
 | 
				
			||||||
    state: absent
 | 
					    state: absent
 | 
				
			||||||
  when: not nextcloud_enabled and is_redhat
 | 
					  when: not nextcloud_enabled and is_redhat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Restart Apache, enabling http://box/nextcloud
 | 
					- name: Restart Apache, enabling/disabling http://box/nextcloud
 | 
				
			||||||
  service:
 | 
					  service:
 | 
				
			||||||
    name: "{{ apache_service }}"
 | 
					    name: "{{ apache_service }}"
 | 
				
			||||||
    state: restarted
 | 
					    state: restarted
 | 
				
			||||||
| 
						 | 
					@ -59,26 +65,34 @@
 | 
				
			||||||
  become_user: "{{ apache_user }}"
 | 
					  become_user: "{{ apache_user }}"
 | 
				
			||||||
  when: nextcloud_enabled and returned.stdout == "false"
 | 
					  when: nextcloud_enabled and returned.stdout == "false"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Determine if Nextcloud user exists already
 | 
					# Code below was NEVER RUNNING as of 2018-10-29, as "wc | cut -d' ' -f1" ALWAYS
 | 
				
			||||||
  shell: >
 | 
					# returns null (rather than the intended returned_count !)  This fragment could
 | 
				
			||||||
    #sudo -u {{ apache_user }}
 | 
					# be replace with "wc -l" or "wc | awk '{print $1}'" if it truly needs fixing?
 | 
				
			||||||
    php '{{ nextcloud_prefix }}/nextcloud/occ' user:list |
 | 
					#
 | 
				
			||||||
    grep {{ nextcloud_user }} | wc | cut -d' ' -f1
 | 
					# Or perhaps default user/password nextcloud/nextcloudmysql (from variables
 | 
				
			||||||
  become: yes
 | 
					# nextcloud_user/nextcloud_user_password) is just not needed in the end...
 | 
				
			||||||
  become_user: "{{ apache_user }}"
 | 
					# 
 | 
				
			||||||
  register: returned_count
 | 
					#- name: Determine if Nextcloud user exists already
 | 
				
			||||||
 | 
					#  shell: >
 | 
				
			||||||
# nextcloud wants to make users rather than just mysql users and not done
 | 
					#    #sudo -u {{ apache_user }}
 | 
				
			||||||
- name: Create the default user
 | 
					#    php '{{ nextcloud_prefix }}/nextcloud/occ' user:list |
 | 
				
			||||||
  shell: >
 | 
					#    grep {{ nextcloud_user }} | wc | cut -d' ' -f1
 | 
				
			||||||
    #su -s /bin/sh {{ apache_user }} -c
 | 
					#    #grep {{ nextcloud_user }} | wc -l
 | 
				
			||||||
    OC_PASS={{ nextcloud_user_password }};
 | 
					#  become: yes
 | 
				
			||||||
    php {{ nextcloud_prefix }}/nextcloud/occ user:add
 | 
					#  become_user: "{{ apache_user }}"
 | 
				
			||||||
    --password-from-env --display-name={{ nextcloud_user }}
 | 
					#  register: returned_count
 | 
				
			||||||
    --group="users" {{ nextcloud_user }}
 | 
					#
 | 
				
			||||||
  become: yes
 | 
					## nextcloud wants to make users rather than just mysql users and not done
 | 
				
			||||||
  become_user: "{{ apache_user }}"
 | 
					#- name: Create the default user
 | 
				
			||||||
  when: nextcloud_enabled and returned_count == "0"
 | 
					#  shell: >
 | 
				
			||||||
 | 
					#    #su -s /bin/sh {{ apache_user }} -c
 | 
				
			||||||
 | 
					#    OC_PASS={{ nextcloud_user_password }};
 | 
				
			||||||
 | 
					#    php {{ nextcloud_prefix }}/nextcloud/occ user:add
 | 
				
			||||||
 | 
					#    --password-from-env --display-name={{ nextcloud_user }}
 | 
				
			||||||
 | 
					#    --group="users" {{ nextcloud_user }}
 | 
				
			||||||
 | 
					#  become: yes
 | 
				
			||||||
 | 
					#  become_user: "{{ apache_user }}"
 | 
				
			||||||
 | 
					#  when: nextcloud_enabled and returned_count == "0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Remove overwrite.cli.url line (Rewrite URL) from /opt/nextcloud/config/config.php
 | 
					- name: Remove overwrite.cli.url line (Rewrite URL) from /opt/nextcloud/config/config.php
 | 
				
			||||||
  lineinfile:
 | 
					  lineinfile:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue