Hi all
I have an ansible playbook that installs apache php sql wordpress etc. It runs and completes. However when I visit the ip address of the server im greeted with he default apache2 page rather than wordpress.
I believe the issue is located in the following code (update default apache site task) but cant figure out what
​
—
# tasks file for wordpress
– name: Download WordPress
get_url:
url=https://wordpress.org/latest.tar.gz
dest=/tmp/wordpress.tar.gz
validate_certs=no
– name: Extract WordPress
unarchive: src=/tmp/wordpress.tar.gz dest=/var/www/ copy=no
become: yes
– name: update default apache site
become: yes
lineinfile:
dest=/etc/apache2/sites-enabled/000-default.conf
regexp=”(.)+DocumentRoot /var/www/html”
line=”DocumentRoot /var/www/wordpress”
notify:
– restart apache
– name: Copy Sample Config File
command: mv /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php creates=/var/www/wordpress/wp-config.php
become: yes
– name: update wordpress using config file
lineinfile:
dest=/var/www/wordpress/wp-config.php
regexp=”{{ item.regexp }}”
line=”{{ item.line }}”
with_items:
– {‘regexp’: “define\\(‘DB_NAME’, ‘(.)+’\\);”, ‘line’: “define(‘DB_NAME’, ‘{{wp_mysql_db}}’};”}
– {‘regexp’: “define\\(‘DB_USER’, ‘(.)+’\\);”, ‘line’: “define(‘DB_USER’, ‘{{wp_mysql_user}}’};”}
– {‘regexp’: “define\\(‘DB_PASSWORD’, ‘(.)+’\\);”, ‘line’: “define(‘DB_PASSWORD’, ‘{{wp_mysql_password}}’};”}
any help would be appreciated.
Normally sites-enabled/000-default.conf has a domain or ip and it’s ports that it listens on.
I think the default page my be in /var/www/html and your install of wordpress may or may not be in /var/www/wordpress.