Advertisement
Guest User

WP Playbook

a guest
Feb 24th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.54 KB | None | 0 0
  1. - name: Add repo file
  2.   template: src=mariadb.list.j2 dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644
  3.   register: mariadb_list
  4.  
  5. - name: Add repo key
  6.   apt_key: id=1BB943DB url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCBCB082A1BB943DB state=present
  7.   register: mariadb_key
  8.  
  9. - name: Update all packages
  10.   apt: upgrade=dist update_cache=yes
  11.  
  12. - name: Unattended package installation
  13.   shell: export DEBIAN_FRONTEND=noninteractive
  14.   changed_when: false
  15.  
  16. - name: Install dependencies for WordPress
  17.   apt: name={{ item }} state=present
  18.   with_items:
  19.        - apache2
  20.         - mariadb-server
  21.         - mariadb-client
  22.         - php5
  23.         - php5-mysql
  24.         - python-mysqldb
  25.  
  26.  
  27. - name: Set root password
  28.   mysql_user: name={{ mysql_root_user }} password={{ mysql_root_password }} host="{{ item }}" priv=*.*:ALL,GRANT state=present
  29.   with_items:
  30.        - "{{ ansible_hostname }}"
  31.         - 127.0.0.1
  32.         - ::1
  33.         - localhost
  34.   ignore_errors: true
  35.  
  36. - name: Copy ~/.my.cnf to nodes
  37.   copy: src=wp-dependencies/templates/my.cnf.j2 dest=/root/.my.cnf
  38.  
  39. - name: Create MariaDB database
  40.   mysql_db: name={{ wp_mysql_db }} state=present
  41.  
  42. - name: Create MariaDB username and password
  43.   mysql_user:
  44.        login_user={{ mysql_root_user }}
  45.         login_password={{ mysql_root_password }}
  46.         name={{ wp_mysql_user }}
  47.         password={{ wp_mysql_password }}
  48.         priv=*.*:ALL
  49.  
  50. - name: Ensure MariaDB is running (and enable it at boot)
  51.   service: name=mariadb state=started enabled=yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement