Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: wordpress_nodes
- become: yes
- vars:
- user_name: "ec2-user"
- blog_path: "/var/www/wp_mbal"
- database_name: "wp_mbal"
- database_user: "user_wp_mbal"
- database_password: ''
- database_host: 'localhost'
- wordpress_archive_url: 'https://pl.wordpress.org/wordpress-4.9.8-pl_PL.tar.gz'
- tasks:
- - name: "Install http server"
- yum:
- name: httpd
- state: latest
- - name: "Install php module"
- yum:
- name: "{{ item }}"
- state: latest
- with_items:
- - php
- - php-mysql
- - name: "Install database server"
- yum:
- name: "{{ item }}"
- with_items:
- - mariadb
- - mariadb-server
- - service:
- name: mariadb
- state: started
- - name: "Download wordpress"
- get_url:
- url: "{{wordpress_archive_url}}"
- dest: ~/wordpress.tar.gz
- - name: "Create directory for wordpress"
- file:
- path: "{{blog_path}}"
- state: directory
- remote_src: yes
- - name: "Unarchive wordpress"
- unarchive:
- src: ~/wordpress.tar.gz
- dest: "{{blog_path}}"
- remote_src: yes
- - name: "Install additional mysql python dependencies"
- yum:
- name: MySQL-python
- state: present
- - name: "Create database"
- mysql_db:
- name: "{{database_name}}"
- state: present
- - name: "Add database user"
- mysql_user:
- name: "{{database_user}}"
- priv: '*.*:ALL'
- state: present
- - name: "Configure apache vhost"
- copy:
- src: templates/vhosts.conf
- dest: /etc/httpd/conf.d/blog.conf
- - name: "Start httpd server"
- service:
- name: httpd
- state: restarted
- - name: "Copy wordpress config"
- template:
- src: templates/wp-config.php
- dest: "{{blog_path}}/wp-config.php"
- owner: "{{user_name}}"
- group: "{{user_name}}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement