1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

change default admin user/pw

allow access from all ips and domains
This commit is contained in:
Tim Moody 2017-06-26 15:24:58 -04:00 committed by georgejhunt
parent 144bb15603
commit 5f663a4b93
3 changed files with 27 additions and 21 deletions

View file

@ -15,7 +15,7 @@ nextcloud_dbpassword: nextcloudmysql
nextcloud_user: nextcloud nextcloud_user: nextcloud
nextcloud_user_password: nextcloudmysql nextcloud_user_password: nextcloudmysql
nextcloud_admin_user: root nextcloud_admin_user: 'Admin'
nextcloud_admin_password: "{{ mysql_root_password }}" nextcloud_admin_password: 'changeme'
nextcloud_required_ip: 10.0.0.0/8 192.168.0.0/16 nextcloud_required_ip: 10.0.0.0/8 192.168.0.0/16

View file

@ -18,13 +18,13 @@
- name: ubuntu and debian treat names differently - name: ubuntu and debian treat names differently
package: name={{ item }} state=present package: name={{ item }} state=present
with_items: with_items:
- libapache2-mod-php5 - libapache2-mod-php5
when: is_debian when: is_debian
- name: ubuntu and debian treat names differently - name: ubuntu and debian treat names differently
package: name={{ item }} state=present package: name={{ item }} state=present
with_items: with_items:
- libapache2-mod-php - libapache2-mod-php
- php-imagick - php-imagick
- php-zip - php-zip
@ -33,7 +33,7 @@
- name: Install list of packages for debuntu - name: Install list of packages for debuntu
package: name={{ item }} state=present package: name={{ item }} state=present
with_items: with_items:
- php{{ php_version }}-gd - php{{ php_version }}-gd
- php{{ php_version }}-json - php{{ php_version }}-json
- php{{ php_version }}-mysql - php{{ php_version }}-mysql
@ -41,10 +41,10 @@
- php{{ php_version }}-intl - php{{ php_version }}-intl
- php{{ php_version }}-mcrypt - php{{ php_version }}-mcrypt
when: is_debuntu when: is_debuntu
- name: Install list of packages - name: Install list of packages
package: name={{ item }} state=present package: name={{ item }} state=present
with_items: with_items:
- php - php
- php-gd - php-gd
- php-json - php-json
@ -55,16 +55,16 @@
# centos does not have a package for php-imagick # centos does not have a package for php-imagick
# - php-imagick # - php-imagick
when: is_redhat when: is_redhat
- name: Copy it to permanent location /opt - name: Copy it to permanent location /opt
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }} unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }}
dest={{ nextcloud_prefix }} dest={{ nextcloud_prefix }}
creates={{ nextcloud_prefix }}/nextcloud/version.php creates={{ nextcloud_prefix }}/nextcloud/version.php
when: not is_F18 when: not is_F18
# ansible 1.4.1 does not have "creates" # ansible 1.4.1 does not have "creates"
- name: Copy it to permanent location /opt - name: Copy it to permanent location /opt
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }} unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }}
dest={{ nextcloud_prefix }} dest={{ nextcloud_prefix }}
when: is_F18 when: is_F18

View file

@ -1,4 +1,4 @@
# This should go in computed_network.yml, but here for now # This should go in computed_network.yml, but here for now
- name: Compute nextcloud listen ip addr for nextcloud.conf - name: Compute nextcloud listen ip addr for nextcloud.conf
set_fact: set_fact:
nextcloud_required_ip: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}" nextcloud_required_ip: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}"
@ -29,34 +29,40 @@
# the install wizard does not succeed if already installed # the install wizard does not succeed if already installed
- name: Determine if nextcloud is installed - name: Determine if nextcloud is installed
shell: > shell: >
sudo -u {{ apache_user }} php sudo -u {{ apache_user }} php
'{{ nextcloud_prefix }}/nextcloud/occ' status | '{{ nextcloud_prefix }}/nextcloud/occ' status |
grep installed: | cut -d' ' -f5 grep installed: | cut -d' ' -f5
register: returned register: returned
- name: Run nextcloud initial install wizard - name: Run nextcloud initial install wizard
shell: > shell: >
cd {{ nextcloud_prefix }}/nextcloud; cd {{ nextcloud_prefix }}/nextcloud;
sudo -u {{ apache_user }} php occ maintenance:install sudo -u {{ apache_user }} php occ maintenance:install
--database "mysql" --database "mysql"
--database-name "{{ nextcloud_dbname }}" --database-name "{{ nextcloud_dbname }}"
--database-user "{{ nextcloud_dbuser }}" --database-user "{{ nextcloud_dbuser }}"
--database-pass "{{ nextcloud_dbpassword }}" --database-pass "{{ nextcloud_dbpassword }}"
--admin-user "root" --admin-user "{{ nextcloud_admin_user }}"
--admin-pass "{{ mysql_root_password }}" --admin-pass "{{ nextcloud_admin_password }}"
when: nextcloud_enabled and returned.stdout == "false"
- name: allow access from all hosts and ips
command: php '{{ nextcloud_prefix }}/nextcloud/occ' config:system:set trusted_domains 1 --value=*
become: true
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 - name: Determine if nextcloud user exists already
shell: > shell: >
sudo -u {{ apache_user }} php sudo -u {{ apache_user }} php
'{{ nextcloud_prefix }}/nextcloud/occ' user:list | '{{ nextcloud_prefix }}/nextcloud/occ' user:list |
grep {{ nextcloud_user }} | wc | cut -d' ' -f1 grep {{ nextcloud_user }} | wc | cut -d' ' -f1
register: returned_count register: returned_count
# nextcloud wants to make users rather than just mysql users and not done # nextcloud wants to make users rather than just mysql users and not done
- name: create the default user - name: create the default user
shell: > shell: >
su -s /bin/sh {{ apache_user }} -c su -s /bin/sh {{ apache_user }} -c
'OC_PASS={{ nextcloud_user_password }}; 'OC_PASS={{ nextcloud_user_password }};
php {{ nextcloud_prefix }}/nextcloud/occ user:add php {{ nextcloud_prefix }}/nextcloud/occ user:add
--password-from-env --display-name={{ nextcloud_user }} --password-from-env --display-name={{ nextcloud_user }}