Resources attached to the Road To DevOps tutorial
https://blog.noobtoroot.xyz/road-to-devops/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.4 KiB
115 lines
2.4 KiB
- hosts: ansible-2 |
|
tasks: |
|
- name: install mariadb-server # DONE |
|
yum: |
|
name: |
|
- MySQL-python |
|
- mariadb-server |
|
- python3-pip |
|
- python3 |
|
- firewalld |
|
state: present |
|
update_cache: yes |
|
|
|
# - name: Install pymysql |
|
# pip: |
|
# name: PyMySQL |
|
# state: present |
|
# executable: pip3 |
|
|
|
- name: create a new database #DONE |
|
mysql_db: |
|
# login_unix_socket: /var/run/mysqld/mysqld.sock |
|
name: wordpress_db |
|
state: present |
|
|
|
- name: create a new user in database wordpress_db #DONE |
|
mysql_user: |
|
# login_unix_socket: /var/run/mysqld/mysqld.sock |
|
name: admin |
|
password: admin |
|
priv: 'wordpress_db.*:ALL' |
|
host: 192.168.56.52 |
|
state: present |
|
|
|
- name: configure firewalld # DONE |
|
firewalld: |
|
service: mysql |
|
permanent: true |
|
state: enabled |
|
immediate: yes |
|
|
|
|
|
- hosts: ansible-1 |
|
tasks: |
|
- name: Install https, php, php-mysqlnd, firewalld |
|
yum: |
|
name: |
|
- httpd |
|
- php |
|
- php-mysqlnd |
|
- firewalld |
|
- php-fpm |
|
state: present |
|
update_cache: yes |
|
|
|
- name: Enable systemctl service installed |
|
service: |
|
name: httpd |
|
state: started |
|
enabled: yes |
|
|
|
- name: Enable php |
|
service: |
|
name: php-fpm |
|
state: started |
|
enabled: yes |
|
|
|
- name: Configure firewalld |
|
firewalld: |
|
service: http |
|
permanent: yes |
|
state: enabled |
|
immediate: yes |
|
|
|
- name: Install wordpress 5.0.8 |
|
unarchive: |
|
src: https://wordpress.org/latest.tar.gz |
|
dest: /var/www/html/ |
|
remote_src: yes |
|
|
|
- name: Create wordpress configuration file |
|
copy: |
|
src: /var/www/html/wordpress/wp-config-sample.php |
|
dest: /var/www/html/wordpress/wp-config.php |
|
remote_src: yes |
|
|
|
- name: Wordpress conf, db name |
|
replace: |
|
dest: /var/www/html/wordpress/wp-config.php |
|
regexp: 'database_name_here' |
|
replace: wordpress_db |
|
|
|
|
|
- name: Wordpress conf, db username |
|
replace: |
|
dest: /var/www/html/wordpress/wp-config.php |
|
regexp: 'username_here' |
|
replace: admin |
|
|
|
- name: Wordpress conf, db passwd |
|
replace: |
|
dest: /var/www/html/wordpress/wp-config.php |
|
regexp: 'password_here' |
|
replace: admin |
|
|
|
- name: Wordpress conf, db host |
|
replace: |
|
dest: /var/www/html/wordpress/wp-config.php |
|
regexp: 'localhost' |
|
replace: 192.168.156.54 |
|
|
|
- name: restart httpd service |
|
service: |
|
name: httpd |
|
state: restarted
|
|
|