Admin How To
40 | DECEMBER 2017 | OPEN SOURCE FOR YOU | http://www.OpenSourceForU.com
+-------------------------------------------+
1 row in set (0.00 sec)
Also, the default MySQL root password is empty. You
should change it after installation. The playbook can be
invoked as follows:
$ ansible-playbook -i inventory/kvm/inventory playbooks/
configuration/piwigo.yml --tags database -K
PHP
Piwigo is written using PHP (PHP Hypertext Preprocessor),
and it requires at least version 5.0 or later. The documentation
website recommends version 5.2. The Ansible playbook to
install PHP is given below:
- name: Install PHP
hosts: ubuntu
become: yes
become_method: sudo
gather_facts: true
tags: [php]
tasks:
- name: Update the software package repository
apt:
update_cache: yes - name: Install PHP
package:
name: “{{ item }}”
state: latest
with_items: - php5
- php5-mysql
Update the software package repository, and install
PHP5 and the php5-mysql database connectivity package.
The Ansible playbook for this can be invoked as follows:
$ ansible-playbook -i inventory/kvm/inventory playbooks/
configuration/piwigo.yml --tags php -K
Piwigo
The final step is to download, install and configure Piwigo.
The playbook for this is given below:
- name: Setup Piwigo
hosts: ubuntu
become: yes
become_method: sudo
gather_facts: true
and at least version 5.0. As the second step, you can install
the same using the following Ansible playbook:
- name: Install MySQL database server
hosts: ubuntu
become: yes
become_method: sudo
gather_facts: true
tags: [database]
tasks:
- name: Update the software package repository
apt:
update_cache: yes - name: Install MySQL
package:
name: “{{ item }}”
state: latest
with_items: - mysql-server
- mysql-client
- python-mysqldb
- name: Start the server
service:
name: mysql
state: started - wait_for:
port: 3306 - mysql_user:
name: guest
password: ‘F7B659FE10CA9FAC576D358A16CC1BC646762FB2’
encrypted: yes
priv: ‘.*:ALL,GRANT’
state: present
The APT software repository is updated first and the
required MySQL packages are then installed. The database
server is started, and the Ansible playbook waits for the
server to listen on port 3306. For this example, a guest
database user account with osfy as the password is chosen
for the gallery Web application. In production, please use
a stronger password. The hash for the password can be
computed from the MySQL client as indicated below:
mysql> SELECT PASSWORD(‘osfy’);
+-------------------------------------------+
| PASSWORD(‘osfy’) |
+-------------------------------------------+
| *F7B659FE10CA9FAC576D358A16CC1BC646762FB2 |