mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
Ansible's recommended indentation/style
This commit is contained in:
parent
f06a1d5231
commit
7cb6120cf3
1 changed files with 43 additions and 37 deletions
|
@ -1,49 +1,54 @@
|
||||||
# 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 }}"
|
||||||
when: ansible_default_ipv4.network is defined
|
when: ansible_default_ipv4.network is defined
|
||||||
|
|
||||||
- name: Enable Nextcloud by copying template to httpd config
|
- name: Enable Nextcloud by copying template to httpd config
|
||||||
template: src=nextcloud.conf.j2
|
template:
|
||||||
dest=/etc/{{ apache_config_dir }}/nextcloud.conf
|
src: nextcloud.conf.j2
|
||||||
owner=root
|
dest: "/etc/{{ apache_config_dir }}/nextcloud.conf"
|
||||||
group=root
|
owner: root
|
||||||
mode=0644
|
group: root
|
||||||
|
mode: 0644
|
||||||
when: nextcloud_enabled
|
when: nextcloud_enabled
|
||||||
|
|
||||||
- name: Enable Nextcloud
|
- name: Enable Nextcloud (debuntu)
|
||||||
file: path=/etc/apache2/sites-enabled/nextcloud.conf
|
file:
|
||||||
src=/etc/apache2/sites-available/nextcloud.conf
|
path: /etc/apache2/sites-enabled/nextcloud.conf
|
||||||
state=link
|
src: /etc/apache2/sites-available/nextcloud.conf
|
||||||
|
state: link
|
||||||
when: nextcloud_enabled and is_debuntu
|
when: nextcloud_enabled and is_debuntu
|
||||||
|
|
||||||
- name: For redhat, remove the config file
|
- name: Remove the config file if not nextcloud_enabled (redhat)
|
||||||
file: path=/etc/{{ apache_config_dir }}/nextcloud.conf
|
file:
|
||||||
state=absent
|
path: "/etc/{{ apache_config_dir }}/nextcloud.conf"
|
||||||
|
state: absent
|
||||||
when: not nextcloud_enabled and is_redhat
|
when: not nextcloud_enabled and is_redhat
|
||||||
|
|
||||||
- name: Restart Apache, so it picks up the new aliases
|
- name: Restart Apache, so it picks up the new aliases
|
||||||
service: name={{ apache_service }} state=restarted
|
service:
|
||||||
|
name: "{{ apache_service }}"
|
||||||
|
state: restarted
|
||||||
|
|
||||||
# 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 |
|
||||||
gawk '/installed:/ { print $3 }'
|
gawk '/installed:/ { print $3 }'
|
||||||
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 "{{ nextcloud_admin_user }}"
|
--admin-user "{{ nextcloud_admin_user }}"
|
||||||
--admin-pass "{{ nextcloud_admin_password }}"
|
--admin-pass "{{ nextcloud_admin_password }}"
|
||||||
when: nextcloud_enabled and returned.stdout == "false"
|
when: nextcloud_enabled and returned.stdout == "false"
|
||||||
|
|
||||||
- name: Allow access from all hosts and ips
|
- name: Allow access from all hosts and ips
|
||||||
|
@ -54,22 +59,23 @@
|
||||||
|
|
||||||
- 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 }}
|
||||||
--group="users" {{ nextcloud_user }}'
|
--group="users" {{ nextcloud_user }}'
|
||||||
when: nextcloud_enabled and returned_count == "0"
|
when: nextcloud_enabled and returned_count == "0"
|
||||||
|
|
||||||
- name: Remove Rewrite URL
|
- name: Remove Rewrite URL
|
||||||
lineinfile: regexp='overwrite.cli.url'
|
lineinfile:
|
||||||
state=absent
|
regexp: "overwrite.cli.url"
|
||||||
dest="{{ nextcloud_prefix }}/nextcloud/config/config.php"
|
state: absent
|
||||||
|
dest: "{{ nextcloud_prefix }}/nextcloud/config/config.php"
|
||||||
|
|
Loading…
Reference in a new issue