-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use lineinfile instead of the command module
- Loading branch information
Lenhard Reuter
committed
Jul 7, 2023
1 parent
d3b8b8e
commit 8a3da7e
Showing
5 changed files
with
92 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
exclude_paths: | ||
- .github | ||
- tests | ||
- .github | ||
- tests | ||
skip_list: | ||
- role-name | ||
- role-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/ansible-community/ansible-lint.git | ||
rev: v6.17.2 | ||
hooks: | ||
- id: ansible-lint | ||
files: \.(yaml|yml)$ | ||
- repo: https://github.com/ansible-community/ansible-lint.git | ||
rev: v6.17.2 | ||
hooks: | ||
- id: ansible-lint | ||
files: \.(yaml|yml)$ | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
--- | ||
- name: Configurate horde | ||
ansible.builtin.template: | ||
src: '{{ item.src }}' | ||
dest: '{{ item.dst }}' | ||
mode: '0644' | ||
group: "{{ item.group | default('www-data') }}" | ||
loop: '{{ horde_templates_list }}' | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dst }}" | ||
mode: "0644" | ||
group: "{{ item.group | default('www-data') }}" | ||
loop: "{{ horde_templates_list }}" | ||
notify: Restart services | ||
|
||
# Enable HTTPS | ||
- name: Copy certificate | ||
ansible.builtin.copy: | ||
src: '{{ item.src }}' | ||
dest: '{{ item.dest }}' | ||
mode: '{{ item.mode }}' | ||
loop: '{{ horde_certificate }}' | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dest }}" | ||
mode: "{{ item.mode }}" | ||
loop: "{{ horde_certificate }}" | ||
|
||
- name: Remove default apache2 configs | ||
ansible.builtin.file: | ||
dest: /etc/apache2/{{ item }} | ||
state: absent | ||
dest: /etc/apache2/{{ item }} | ||
state: absent | ||
loop: | ||
- sites-available/000-default.conf | ||
- sites-enabled/000-default.conf | ||
- sites-available/default-ssl.conf | ||
- sites-enabled/default-ssl.conf | ||
- conf-available/php-horde.conf | ||
- conf-enabled/php-horde.conf | ||
- sites-available/000-default.conf | ||
- sites-enabled/000-default.conf | ||
- sites-available/default-ssl.conf | ||
- sites-enabled/default-ssl.conf | ||
- conf-available/php-horde.conf | ||
- conf-enabled/php-horde.conf | ||
notify: Restart apache2 | ||
|
||
- name: Ensure log directory exist | ||
ansible.builtin.file: | ||
path: '{{ horde_log_path }}' | ||
state: directory | ||
mode: '0750' | ||
path: "{{ horde_log_path }}" | ||
state: directory | ||
mode: "0750" | ||
|
||
- name: Activate apache2_modules | ||
community.general.apache2_module: | ||
name: '{{ item }}' | ||
state: present | ||
loop: '{{ horde_apache2modules }}' | ||
name: "{{ item }}" | ||
state: present | ||
loop: "{{ horde_apache2modules }}" | ||
become: true | ||
|
||
- name: Manual apache2 restart | ||
ansible.builtin.service: | ||
name: apache2 | ||
state: restarted | ||
name: apache2 | ||
state: restarted | ||
|
||
- name: Activate webmail | ||
ansible.builtin.command: a2ensite webmail | ||
args: | ||
creates: /etc/apache2/sites-enabled/webmail.conf | ||
creates: /etc/apache2/sites-enabled/webmail.conf | ||
notify: Restart apache2 | ||
changed_when: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,93 @@ | ||
--- | ||
- name: Check if horde pear channel is installed | ||
ansible.builtin.shell: | ||
cmd: | | ||
set -o pipefail | ||
pear list-channels | grep pear.horde.org | ||
cmd: | | ||
set -o pipefail | ||
pear list-channels | grep pear.horde.org | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
register: channel_registered | ||
failed_when: channel_registered.rc >= 2 | ||
changed_when: channel_registered.stdout | ||
|
||
- name: Discover horde PEAR channel | ||
ansible.builtin.shell: | ||
cmd: | | ||
set -o pipefail | ||
pear channel-discover pear.horde.org | ||
cmd: | | ||
set -o pipefail | ||
pear channel-discover pear.horde.org | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
changed_when: false | ||
when: channel_registered.stdout == '' | ||
|
||
- name: Check if horde pear package is installed | ||
ansible.builtin.shell: | ||
cmd: | | ||
set -o pipefail | ||
pear list -c pear.horde.org | grep Horde_Role | ||
cmd: | | ||
set -o pipefail | ||
pear list -c pear.horde.org | grep Horde_Role | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
register: package_installed | ||
failed_when: package_installed.rc >= 2 | ||
changed_when: package_installed.stdout == '' | ||
|
||
- name: Install horde package | ||
ansible.builtin.shell: | ||
cmd: pear install horde/horde_role | ||
cmd: pear install horde/horde_role | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
changed_when: false | ||
become: true | ||
when: package_installed.stdout == '' | ||
|
||
- name: Fix unexpected 'new' (T_NEW) error | ||
ansible.builtin.shell: | ||
cmd: 'pear uninstall {{ item }}' | ||
cmd: pear uninstall {{ item }} | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
changed_when: false | ||
loop: | ||
- File_Fstab | ||
- Services_Weather | ||
- horde/Horde_Service_Weather | ||
- File_Fstab | ||
- Services_Weather | ||
- horde/Horde_Service_Weather | ||
|
||
- name: Fixing syntax error in a dependency PHP module. | ||
- name: Fixing syntax error in a dependency PHP module | ||
become: true | ||
ansible.builtin.command: | ||
cmd: sed -i '167s/&//' /usr/share/php/Services/Weather.php | ||
ansible.builtin.lineinfile: | ||
path: /usr/share/php/Services/Weather.php | ||
regexp: ^.*$ | ||
line: "" | ||
backup: true | ||
changed_when: false | ||
failed_when: false | ||
when: package_installed.stdout == '' | ||
tags: | ||
- skip_ansible_lint | ||
|
||
- name: Execute Horde run scripts | ||
become: true | ||
ansible.builtin.expect: | ||
args: | ||
command: pear run-scripts horde/horde_role | ||
responses: '{{ horde_run_scripts_responses }}' | ||
echo: true | ||
command: pear run-scripts horde/horde_role | ||
responses: "{{ horde_run_scripts_responses }}" | ||
echo: true | ||
register: run_scripts_install_result | ||
failed_when: | ||
run_scripts_install_result.rc != 0 and 'Install scripts complete' not in | ||
run_scripts_install_result.stdout | ||
failed_when: run_scripts_install_result.rc != 0 and 'Install scripts complete' not in run_scripts_install_result.stdout | ||
|
||
- name: Check if horde pear webmail is installed | ||
ansible.builtin.shell: | ||
cmd: | | ||
set -o pipefail | ||
pear list -c pear.horde.org | grep webmail | ||
cmd: | | ||
set -o pipefail | ||
pear list -c pear.horde.org | grep webmail | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
register: webmail_package_installed | ||
failed_when: webmail_package_installed.rc >= 2 | ||
changed_when: webmail_package_installed.stdout == '' | ||
|
||
- name: Install horde webmail | ||
become: true | ||
ansible.builtin.shell: | ||
cmd: pear install -a -B --force horde/webmail | ||
cmd: pear install -a -B --force horde/webmail | ||
args: | ||
executable: /bin/bash | ||
executable: /bin/bash | ||
changed_when: false | ||
when: webmail_package_installed.stdout == '' |