Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Add repo file
- template: src=mariadb.list.j2 dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644
- register: mariadb_list
- - name: Add repo key
- apt_key: id=1BB943DB url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCBCB082A1BB943DB state=present
- register: mariadb_key
- - name: Update all packages
- apt: upgrade=dist update_cache=yes
- - name: Unattended package installation
- shell: export DEBIAN_FRONTEND=noninteractive
- changed_when: false
- - name: Install dependencies for WordPress
- apt: name={{ item }} state=present
- with_items:
- - apache2
- - mariadb-server
- - mariadb-client
- - php5
- - php5-mysql
- - python-mysqldb
- - name: Set root password
- mysql_user: name={{ mysql_root_user }} password={{ mysql_root_password }} host="{{ item }}" priv=*.*:ALL,GRANT state=present
- with_items:
- - "{{ ansible_hostname }}"
- - 127.0.0.1
- - ::1
- - localhost
- ignore_errors: true
- - name: Copy ~/.my.cnf to nodes
- copy: src=wp-dependencies/templates/my.cnf.j2 dest=/root/.my.cnf
- - name: Create MariaDB database
- mysql_db: name={{ wp_mysql_db }} state=present
- - name: Create MariaDB username and password
- mysql_user:
- login_user={{ mysql_root_user }}
- login_password={{ mysql_root_password }}
- name={{ wp_mysql_user }}
- password={{ wp_mysql_password }}
- priv=*.*:ALL
- - name: Ensure MariaDB is running (and enable it at boot)
- service: name=mariadb state=started enabled=yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement