Issue
[☺ first time posting here, I have huge problems with formating so sorry, I really dont understand how to get that code to the grey boxes, sorry!) Hello, so I am supposed to set up a server using Ansible for a high school graduation project. All I have to do is basicaly install a few programs like htop, httpd ..... and finally set up a wordpress server. I am folowing this guide.
Problem is that this code:
---
# tasks file for wp-dependencies
- name: Update packages (this is equivalent to yum update -y)
yum: name=* state=latest
- name: Install dependencies for WordPress
yum:
name:
- php
- php-mysql
- MySQL-python
state: present
- name: Ensure MariaDB is running (and enable it at boot)
service: name=mariadb state=started enabled=yes
- name: Copy ~/.my.cnf to nodes
copy: src=.my.cnf 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=root login_password=root name = {{ wp_mysql_user }} password = {{ wp_mysql_password }}
priv=*.*:ALL`
Results in this error:
TASK [wp-dependencies : Create MariaDB username and password] ******************************************
fatal: [192.168.56.101]: FAILED! => {"changed": false, "msg": "missing required arguments: user"}
to retry, use: --limit @/home/Admin/wordpress.retry
COuld you tell whats the problem?
Solution
Your task is this:
- name: Create MariaDB username and password
mysql_user: login_user=root login_password=root name = {{ wp_mysql_user }} password = {{ wp_mysql_password }}
priv=*.*:ALL`
You have spaces between name
and password
and the values they are to take. And for safe variable handling you should also place quotation marks (") around the variables.
Try this:
- name: Create MariaDB username and password
mysql_user: login_user=root login_password=root name="{{ wp_mysql_user }}" password="{{ wp_mysql_password }}" priv=*.*:ALL
Answered By - dan_linder Answer Checked By - Mildred Charles (WPSolving Admin)