Skip to content

Commit

Permalink
sort out other linter complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
suhancz committed Oct 27, 2023
1 parent 786f7bb commit fe38460
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tasks/backups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
- pdns
- wg_vpn
- name: Restore non-service tarball backups
when: vars[item ~ '_backup_path'] is defined }}"
when: vars[item ~ '_backup_path'] is defined
ansible.builtin.unarchive:
src: "{{ vars[item ~ '_backup_path'] }}"
dest: /
Expand Down
3 changes: 3 additions & 0 deletions tasks/dnsdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
src: dnsdist/dnsdist.conf.j2
dest: /etc/dnsdist/dnsdist.conf
backup: yes
owner: dnsdist
group: dnsdist
mode: u=rw,g=r,o=
when: 'public_dns == "yes"'
notify: Restart dnsdist
3 changes: 3 additions & 0 deletions tasks/fail2ban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
ansible.builtin.copy:
src: "fail2ban/{{ item }}"
dest: "/etc/fail2ban/filter.d/{{ item }}"
owner: root
group: root
mode: u=rw,go=r
loop:
- postfixadmin.conf
notify: Restart fail2ban
Expand Down
8 changes: 4 additions & 4 deletions tasks/gather_wireguard_config_sections.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- name: Set server config
when: '{{ "[Interface]" == wireguard_config_line }}'
when: wireguard_config_line == "[Interface]"
ansible.builtin.set_fact:
current_wireguard_section: server
- name: Set server private key
when: current_wireguard_section == 'server' and 'PrivateKey' in wireguard_config_line
ansible.builtin.set_fact:
wg_server_private_key: "{{ wireguard_config_line | split(' ') | last }}"
- name: Set client config
when: '{{ "[Peer]" == wireguard_config_line }}'
when: wireguard_config_line == "[Peer]"
ansible.builtin.set_fact:
current_wireguard_section: client
wg_client_count: "{{ wg_client_count | default(0) | int + 1 }}"
Expand All @@ -29,10 +29,10 @@
ansible.builtin.set_fact:
wg_server: '{{ wg_server | default({}) | combine({"privatekey": wg_server_private_key}) }}'
- name: Set wireguard config client section
when: '{{ "[Peer]" == wireguard_config_line }}'
when: wireguard_config_line == "[Peer]"
ansible.builtin.set_fact:
last_wg_client: '{{ wg_client_count | default(0) }}'
- name: Set wireguard config client section
when: current_wireguard_section == 'client' and (wg_client_count < last_wg_client or ansible_loop.last) and wg_client_name is defined and wg_client_owner is defined and wg_client_psk is defined
ansible.builtin.set_fact:
wg_clients: '{{ wg_clients | default([]) + {"name": wg_client_name, "owner": wg_client_owner, "psk": wg_server_psk} }}'
wg_clients: '{{ wg_clients | default([]) + [{"name": wg_client_name, "owner": wg_client_owner, "psk": wg_server_psk}] }}'
3 changes: 2 additions & 1 deletion tasks/horde.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
dest: /tmp
remote_src: yes
- name: Install themes
shell: 'echo -e "/usr/share/horde\nroot\nroot\n755\n644\nYes\n"|./install.sh'
ansible.builtin.shell: 'set -o pipefail && echo -e "/usr/share/horde\nroot\nroot\n755\n644\nYes\n"|./install.sh'
args:
chdir: /tmp/combined-1.0.0
executable: /usr/bin/bash
7 changes: 5 additions & 2 deletions tasks/httpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- http
- https
- name: Set up SELinux rules
when: "{{ getenforce.stdout != 'Disabled' }}"
when: getenforce.stdout != 'Disabled'
block:
- name: Set SELinux booleans
seboolean:
Expand All @@ -27,11 +27,14 @@
- httpd_read_user_content
- httpd_mod_auth_pam
- name: Generate SELinux policy
shell: |
ansible.builtin.shell: |
set -o pipefail &&
sepolicy generate --init /usr/sbin/httpd
echo 'dovecot_read_config(httpd_t)' >> httpd.te
./httpd.sh
ausearch -m AVC -ts recent | audit2allow -R
args:
executable: /usr/bin/bash
- name: Render web config templates
tags:
- dyndns
Expand Down
2 changes: 1 addition & 1 deletion tasks/mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
state: stopped
- name: Start MariaDB in safe mode
when: reset == "yes" or forgotten_mariadb_root_password
shell: "mysqld_safe --skip-grant-tables --skip-networking &"
ansible.builtin.shell: "mysqld_safe --skip-grant-tables --skip-networking &"
- name: "Generate MariaDB root password reset SQL"
when: reset == "yes" or forgotten_mariadb_root_password
ansible.builtin.template:
Expand Down
2 changes: 1 addition & 1 deletion tasks/os.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Check SELinux status
shell: getenforce
ansible.builtin.shell: getenforce
register: getenforce
tags: always
- name: "Set hostname to {{ mailserver_hostname }}.{{ mailserver_domain }}" # noqa name[template] we need to be informative, even if we deviate from the standards
Expand Down
4 changes: 3 additions & 1 deletion tasks/wireguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@
loop: "{{ wg_configs.keys() }}"
when: item != "server"
- name: Generate QR codes
shell: "cat {{ user_home[wg_configs[item]['owner']] }}/public_html/.vpn/{{ item }}/wg0.conf | qrencode -o {{ user_home[wg_configs[item]['owner']] }}/public_html/.vpn/{{ item }}/wg0.png"
ansible.builtin.shell: "set -o pipefail && cat {{ user_home[wg_configs[item]['owner']] }}/public_html/.vpn/{{ item }}/wg0.conf | qrencode -o {{ user_home[wg_configs[item]['owner']] }}/public_html/.vpn/{{ item }}/wg0.png"
args:
executable: /usr/bin/bash
loop: "{{ wg_configs.keys() }}"
when: item != "server"
- name: Allow access to QR codes
Expand Down

0 comments on commit fe38460

Please sign in to comment.