apache: Convert modules to use FQCN

This commit is contained in:
Timo Makinen 2022-04-14 13:12:32 +00:00
parent 2ac8d539be
commit b24e7feaeb

View file

@ -1,6 +1,6 @@
--- ---
- name: install apache - name: install apache
package: ansible.builtin.package:
name: "{{ item }}" name: "{{ item }}"
state: installed state: installed
with_items: with_items:
@ -8,7 +8,7 @@
- mod_ssl - mod_ssl
- name: disable plain http and default included configs - name: disable plain http and default included configs
lineinfile: ansible.builtin.lineinfile:
path: /etc/httpd/conf/httpd.conf path: /etc/httpd/conf/httpd.conf
line: "#{{ item }}" line: "#{{ item }}"
regexp: "^#?{{ item|replace('*', '\\*') }}" regexp: "^#?{{ item|replace('*', '\\*') }}"
@ -18,26 +18,26 @@
notify: restart apache notify: restart apache
- name: set server admin address - name: set server admin address
lineinfile: ansible.builtin.lineinfile:
path: /etc/httpd/conf/httpd.conf path: /etc/httpd/conf/httpd.conf
line: "ServerAdmin webmaster@{{ mail_domain }}" line: "ServerAdmin webmaster@{{ mail_domain }}"
regexp: "#?ServerAdmin .*" regexp: "#?ServerAdmin .*"
notify: restart apache notify: restart apache
- name: include local configs - name: include local configs
lineinfile: ansible.builtin.lineinfile:
path: /etc/httpd/conf/httpd.conf path: /etc/httpd/conf/httpd.conf
line: "IncludeOptional conf.local.d/*.conf" line: "IncludeOptional conf.local.d/*.conf"
notify: restart apache notify: restart apache
- name: fix selinux contexts from data directory - name: fix selinux contexts from data directory
sefcontext: community.general.sefcontext:
path: /srv/web(/.*)? path: /srv/web(/.*)?
setype: httpd_sys_content_t setype: httpd_sys_content_t
when: ansible_selinux_python_present when: ansible_selinux_python_present
- name: create data and config directories - name: create data and config directories
file: ansible.builtin.file:
state: directory state: directory
path: "{{ item }}" path: "{{ item }}"
mode: 0755 mode: 0755
@ -51,7 +51,7 @@
- "/etc/httpd/conf.local.d" - "/etc/httpd/conf.local.d"
- name: create ssl config - name: create ssl config
template: ansible.builtin.template:
src: ssl.conf.j2 src: ssl.conf.j2
dest: /etc/httpd/conf.local.d/ssl.conf dest: /etc/httpd/conf.local.d/ssl.conf
mode: 0644 mode: 0644
@ -60,7 +60,7 @@
notify: restart apache notify: restart apache
- name: create site config - name: create site config
template: ansible.builtin.template:
src: site.conf.j2 src: site.conf.j2
dest: "/etc/httpd/conf.local.d/{{ inventory_hostname }}.conf" dest: "/etc/httpd/conf.local.d/{{ inventory_hostname }}.conf"
mode: 0644 mode: 0644
@ -69,7 +69,7 @@
notify: restart apache notify: restart apache
- name: fix log directory permissions - name: fix log directory permissions
file: ansible.builtin.file:
path: /var/log/httpd path: /var/log/httpd
state: directory state: directory
mode: 0755 mode: 0755
@ -77,7 +77,7 @@
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
- name: import sftpuser role - name: import sftpuser role
import_role: ansible.builtin.import_role:
name: sftpuser name: sftpuser
vars: vars:
chroot: "/var/log/httpd" chroot: "/var/log/httpd"
@ -85,7 +85,7 @@
publickeys: "{{ logsync_publickeys }}" publickeys: "{{ logsync_publickeys }}"
- name: enable apache - name: enable apache
service: ansible.builtin.service:
name: httpd name: httpd
state: started state: started
enabled: true enabled: true