Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.60 KB | None | 0 0
  1. ---
  2. - name: server-setup
  3. hosts: "{{server}}"
  4. tasks:
  5. - name: Set timezone
  6. timezone:
  7. name: America/New_York
  8. - name: upgrade all packages
  9. yum:
  10. name: '*'
  11. state: latest
  12. - name: Install epel-release
  13. yum:
  14. name:
  15. - epel-release
  16. - name: Install wget
  17. yum:
  18. name:
  19. - wget
  20. - name: Add Openlitespeed repo
  21. yum:
  22. name: http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
  23. state: present
  24. - name: Add MariaDB 10 Repo
  25. yum_repository:
  26. name: mariadb
  27. description: MariaDB
  28. baseurl: http://yum.mariadb.org/10.4/centos7-amd64
  29. gpgkey: https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  30. gpgcheck: true
  31. state: present
  32. - name: Install common software requirements
  33. yum:
  34. name:
  35. - openlitespeed
  36. - fail2ban
  37. - htop
  38. - 'lsphp56*'
  39. - 'lsphp73*'
  40. - 'lsphp74*'
  41. - MariaDB-server
  42. - MariaDB-client
  43. - ImageMagick
  44. - ghostscript
  45. - certbot
  46. - ncftp
  47. - holland
  48. - holland-mysqldump
  49. - zip
  50. - unzip
  51. - yum-cron
  52. - monit
  53. - name: start lsws and set to start at boot
  54. systemd:
  55. name: lsws
  56. state: started
  57. enabled: yes
  58. - name: start mariadb and set to start at boot
  59. systemd:
  60. name: mariadb
  61. state: started
  62. enabled: yes
  63. - name: start postfix and set to start at boot
  64. systemd:
  65. name: postfix
  66. state: started
  67. enabled: yes
  68. - name: open port 80 in firewall
  69. firewalld:
  70. service: http
  71. permanent: yes
  72. state: enabled
  73. - name: open port 443 in firewall
  74. firewalld:
  75. service: https
  76. permanent: yes
  77. state: enabled
  78. - name: open port 7080 in firewall
  79. firewalld:
  80. port: 7080/tcp
  81. permanent: yes
  82. state: enabled
  83. - name: open port 2812 in firewall
  84. firewalld:
  85. port: 2812/tcp
  86. permanent: yes
  87. state: enabled
  88. - name: firewalld reload
  89. command: firewall-cmd --reload
  90. - name: copy fail2ban files to the linode servers
  91. shell: |
  92. rsync -avzh root@projects.appnet.com:/etc/ansible/playbooks/server-setup/fail2ban/jail.local.new /etc/fail2ban/jail.local
  93. rsync -avzh root@projects.appnet.com:/etc/ansible/playbooks/server-setup/fail2ban/filter.d/wordpress.conf /etc/fail2ban/filter.d/wordpress.conf
  94. - name: start fail2ban and set to start at boot
  95. systemd:
  96. name: fail2ban
  97. state: started
  98. enabled: yes
  99. - name: copy holland files to the linode servers
  100. shell: |
  101. rsync -avzh root@projects.appnet.com:/etc/ansible/playbooks/server-setup/holland/holland.conf /etc/holland/holland.conf
  102. rsync -avzh root@projects.appnet.com:/etc/ansible/playbooks/server-setup/holland/backupsets/default.conf /etc/holland/backupsets/default.conf
  103. - name: create /var/www directory
  104. file:
  105. path: /var/www
  106. state: directory
  107. - name: create /var/www/vhosts directory
  108. file:
  109. path: /var/www/vhosts
  110. state: directory
  111. - name: Ensure group "appnet" exists
  112. group:
  113. name: appnet
  114. state: present
  115. - name: Ensure group "sftponly" exists
  116. group:
  117. name: sftponly
  118. state: present
  119. - name: Add the user 'appnet' with a specific uid and a primary group of 'appnet'
  120. user:
  121. name: appnet
  122. shell: /sbin/nologin
  123. groups:
  124. - appnet
  125. - sftponly
  126. state: present
  127. createhome: no
  128. home: /var/www/vhosts
  129. - name: set PHP 5.6 variables
  130. ini_file:
  131. path: /usr/local/lsws/lsphp56/etc/php.ini
  132. section: "{{ item.section }}"
  133. option: "{{ item.option }}"
  134. value: "{{ item.value }}"
  135. with_items:
  136. - { section: "PHP", option: "short_open_tag", value: "On" }
  137. - { section: "PHP", option: "max_execution_time", value: "300" }
  138. - { section: "PHP", option: "max_input_time", value: "300" }
  139. - { section: "PHP", option: "memory_limit", value: "128M" }
  140. - { section: "PHP", option: "post_max_size", value: "32M" }
  141. - { section: "PHP", option: "upload_max_filesize", value: "32M" }
  142. - { section: "PHP", option: "date.timezone", value: "'America/New_York'" }
  143. - { section: "PHP", option: "session.save_path", value: "'/tmp'" }
  144. - name: set PHP 7.3 variables
  145. ini_file:
  146. path: /usr/local/lsws/lsphp73/etc/php.ini
  147. section: "{{ item.section }}"
  148. option: "{{ item.option }}"
  149. value: "{{ item.value }}"
  150. with_items:
  151. - { section: "PHP", option: "short_open_tag", value: "On" }
  152. - { section: "PHP", option: "max_execution_time", value: "300" }
  153. - { section: "PHP", option: "max_input_time", value: "300" }
  154. - { section: "PHP", option: "memory_limit", value: "128M" }
  155. - { section: "PHP", option: "post_max_size", value: "32M" }
  156. - { section: "PHP", option: "upload_max_filesize", value: "32M" }
  157. - { section: "PHP", option: "date.timezone", value: "'America/New_York'" }
  158. - { section: "PHP", option: "session.save_path", value: "'/tmp'" }
  159. - name: set PHP 7.4 variables
  160. ini_file:
  161. path: /usr/local/lsws/lsphp74/etc/php.ini
  162. section: "{{ item.section }}"
  163. option: "{{ item.option }}"
  164. value: "{{ item.value }}"
  165. with_items:
  166. - { section: "PHP", option: "short_open_tag", value: "On" }
  167. - { section: "PHP", option: "max_execution_time", value: "300" }
  168. - { section: "PHP", option: "max_input_time", value: "300" }
  169. - { section: "PHP", option: "memory_limit", value: "128M" }
  170. - { section: "PHP", option: "post_max_size", value: "32M" }
  171. - { section: "PHP", option: "upload_max_filesize", value: "32M" }
  172. - { section: "PHP", option: "date.timezone", value: "'America/New_York'" }
  173. - { section: "PHP", option: "session.save_path", value: "'/tmp'" }
  174. - name: Edit SSHD Config
  175. lineinfile:
  176. path: /etc/ssh/sshd_config
  177. regexp: '^Subsystem'
  178. line: 'Subsystem sftp internal-sftp'
  179. - name: Edit SSHD Config Part 2
  180. blockinfile:
  181. path: /etc/ssh/sshd_config
  182. block: |
  183. Match Group sftponly
  184. ChrootDirectory %h
  185. X11Forwarding no
  186. AllowTCPForwarding no
  187. ForceCommand internal-sftp -u 0002
  188. roles:
  189. - {role: sbaerlocher.wp-cli}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement