---
- hosts: localhost
connection: local
gather_facts: yes
vars_files:
- 'vars/main.yml'
tasks:
- name: set timezone to UTC
timezone:
name: UTC
185.xxx.xxx.202 ansible_connection=ssh ansible_user=root ansible_ssh_private_key_file=/root/.ssh/id_rsa
register:
tasks:
- name: 'Pwgen Username Password'
command: pwgen 12 1
register: userpass
{{ userpass }}
###
- name: 'Pwgen MySQL User Password'
command: pwgen 12 1
register: mysql_user_pass
- name: 'Add MySQL DB'
mysql_db: 'name={{ username }} encoding=utf8 login_user=root login_password={{ mysql_root_pass }} state=present'
- name: 'Add MySQL user'
mysql_user: 'name={{ username }} password={{ mysql_user_pass.stdout }} priv={{ username }}.*:ALL login_user=root login_password={{ mysql_root_pass }} state=present'
- name: 'Default configs Apache2 & PHP'
template: 'src={{item.src}} dest={{item.dest}} backup=yes'
with_items:
- { src: 'templates/apache2/000-default.conf.j2', dest: '/etc/apache2/sites-available/000-default.conf' }
- { src: 'templates/php/7.0/cli/php.ini.j2', dest: '/etc/php/7.0/cli/php.ini' }
- { src: 'templates/php/7.0/apache2/php.ini.j2', dest: '/etc/php/7.0/apache2/php.ini' }
notify:
- 'apache2 reload'