Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

wordpress-nginx-rhel7 linted and updated #324

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
- name: Install Mysql package
yum: name={{ item }} state=present
with_items:
- mysql-server
- MySQL-python
- libselinux-python
- libsemanage-python
- mysql-server
- MySQL-python
- libselinux-python
- libsemanage-python

- name: Configure SELinux to start mysql on any port
seboolean: name=mysql_connect_any state=true persistent=yes
Expand All @@ -14,7 +14,7 @@
- name: Create Mysql configuration file
template: src=my.cnf.j2 dest=/etc/my.cnf
notify:
- restart mysql
- restart mysql

- name: Start Mysql Service
service: name=mysqld state=started enabled=yes
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove this change, because it wasn't planed. But i although would like to remove the whole wordpress-nginx_rhel6 folder, because its totally outdated.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- name: Download WordPress
get_url: url=http://wordpress.org/wordpress-{{ wp_version }}.tar.gz dest=/srv/wordpress-{{ wp_version }}.tar.gz
sha256sum="{{ wp_sha256sum }}"
get_url: url=http://wordpress.org/wordpress-{{ wp_version }}.tar.gz dest=/srv/wordpress-{{ wp_version }}.tar.gz sha256sum="{{ wp_sha256sum }}"

- name: Extract archive
unarchive:
Expand All @@ -18,8 +17,8 @@
- name: Fetch random salts for WordPress config
get_url:
url: https://api.wordpress.org/secret-key/1.1/salt/
register: "wp_salt"
become: no
register: wp_salt
become: false
become_method: sudo
changed_when: true
delegate_to: localhost
Expand Down
File renamed without changes.
29 changes: 0 additions & 29 deletions wordpress-nginx_rhel7/roles/common/files/RPM-GPG-KEY-EPEL-7

This file was deleted.

28 changes: 0 additions & 28 deletions wordpress-nginx_rhel7/roles/common/files/RPM-GPG-KEY-NGINX

This file was deleted.

24 changes: 0 additions & 24 deletions wordpress-nginx_rhel7/roles/common/files/RPM-GPG-KEY-remi

This file was deleted.

8 changes: 0 additions & 8 deletions wordpress-nginx_rhel7/roles/common/files/epel.repo

This file was deleted.

18 changes: 13 additions & 5 deletions wordpress-nginx_rhel7/roles/common/files/nginx.repo
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
[nginx]
name=Nginx repo - $basearch
baseurl=http://nginx.org/packages/centos/7/$basearch
failovermethod=priority
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NGINX
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
67 changes: 0 additions & 67 deletions wordpress-nginx_rhel7/roles/common/files/remi.repo

This file was deleted.

46 changes: 33 additions & 13 deletions wordpress-nginx_rhel7/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
---
- name: Copy the NGINX repository definition
copy: src=nginx.repo dest=/etc/yum.repos.d/
ansible.builtin.copy:
src: nginx.repo
dest: /etc/yum.repos.d/
owner: root
group: root
mode: u=rw,g=r,o=r

- name: Copy the EPEL repository definition
copy: src=epel.repo dest=/etc/yum.repos.d/
- name: Install the EPEL repository definition
ansible.builtin.yum:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
state: present

- name: Copy the REMI repository definition
copy: src=remi.repo dest=/etc/yum.repos.d/
- name: Install the REMI repository definition
ansible.builtin.yum:
name: https://rpms.remirepo.net/enterprise/remi-release-7.rpm
state: present

- name: Create the GPG key for NGINX
copy: src=RPM-GPG-KEY-NGINX dest=/etc/pki/rpm-gpg
ansible.builtin.rpm_key:
state: present
key: https://nginx.org/keys/nginx_signing.key

- name: Create the GPG key for EPEL
copy: src=RPM-GPG-KEY-EPEL-7 dest=/etc/pki/rpm-gpg
- name: Create the GPG key for EPEL 7
ansible.builtin.rpm_key:
state: present
key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7

- name: Create the GPG key for Remi Repo EL 7
ansible.builtin.rpm_key:
state: present
key: https://rpms.remirepo.net/enterprise/7/RPM-GPG-KEY-remi

- name: Create the GPG key for REMI
copy: src=RPM-GPG-KEY-remi dest=/etc/pki/rpm-gpg

- name: Install Firewalld
yum: name=firewalld state=present
ansible.builtin.yum:
name: firewalld
state: present

- name: Firewalld service state
service: name=firewalld state=started enabled=yes
ansible.builtin.service:
name: firewalld
state: started
enabled: true
7 changes: 5 additions & 2 deletions wordpress-nginx_rhel7/roles/mariadb/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
# Handler to handle DB tier notifications

- name: restart mariadb
service: name=mariadb state=restarted
- name: Restart mariadb
ansible.builtin.service:
name: mariadb
state: restarted
listen: restart mariadb
51 changes: 36 additions & 15 deletions wordpress-nginx_rhel7/roles/mariadb/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
---
# This playbook will install MariaDB and create db user and give permissions.

- name: Install MariaDB package
yum: name={{ item }} state=installed
with_items:
- mariadb-server
- MySQL-python
- libselinux-python
- libsemanage-python
ansible.builtin.yum:
name: "{{ mariadb_packages }}"
state: installed
vars:
mariadb_packages:
- mariadb-server
- MySQL-python
- libselinux-python
- libsemanage-python

- name: Configure SELinux to start mysql on any port
seboolean: name=mysql_connect_any state=true persistent=yes
ansible.posix.seboolean:
name: mysql_connect_any
state: true
persistent: true

- name: Create Mysql configuration file
template: src=my.cnf.j2 dest=/etc/my.cnf
ansible.builtin.template:
src: my.cnf.j2
dest: /etc/my.cnf
owner: root
group: mysql
mode: u=rw,g=r,o=r
notify:
- restart mariadb
- restart mariadb

- name: Create MariaDB log file
file: path=/var/log/mysqld.log state=touch owner=mysql group=mysql mode=0775
ansible.builtin.file:
path: /var/log/mysqld.log
state: touch
owner: mysql
group: mysql
mode: u=rwx,g=rwx,o=rx

- name: Start MariaDB Service
service: name=mariadb state=started enabled=yes
ansible.builtin.service:
name: mariadb
state: started
enabled: true

- name: insert firewalld rule
firewalld: port={{ mysql_port }}/tcp permanent=true state=enabled immediate=yes
ignore_errors: yes
- name: Insert firewalld rule
ansible.posix.firewalld:
port: "{{ mysql_port }}/tcp "
permanent: true
state: enabled
immediate: true
8 changes: 6 additions & 2 deletions wordpress-nginx_rhel7/roles/nginx/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
- name: restart nginx
service: name=nginx state=restarted enabled=yes
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted
enabled: true
listen: restart nginx
Loading