Vagrant and Ansible revisited and updated for Ubuntu 16.04

parent a7c4d676
......@@ -3,8 +3,8 @@
Vagrant.configure(2) do |config|
# "ubuntu/trusty64" for ubuntu environment
# "boxcutter/centos71" for AWS similar environment
config.vm.box = "boxcutter/centos72"
# "boxcutter/centos72" for AWS similar environment
config.vm.box = "aspyatkin/ubuntu-16.04-server-amd64"
config.vm.network "forwarded_port", guest: 1337, host: 1337
config.vm.network "forwarded_port", guest: 80, host: 8080
config.ssh.insert_key = false
......
---
- name: Install MySQL repos
apt:
deb: http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
state: present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Set MySQL root password before installing
debconf: name='mysql-server' question='mysql-server/root_password' value='{{database_root_passwd | quote}}' vtype='password'
- name: Update apt-get cache
apt:
update-cache: yes
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Confirm MySQL root password before installing
debconf: name='mysql-server' question='mysql-server/root_password_again' value='{{database_root_passwd | quote}}' vtype='password'
- name: Install mysql packages
apt:
name: "{{ item }}"
state: present
with_items:
- mysql-server-5.7
- mysql-client
- python-mysqldb # required by ansible
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Add MySQL community repository
yum:
name: "http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm"
state: present
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7'
- name: Install mysql packages
yum:
name: "{{ item }}"
state: present
- name: Install MySQL
apt: package={{ item }} state=installed force=yes update_cache=yes cache_valid_time=3600
when: ansible_os_family == 'Debian'
with_items:
- mysql-server
- MySQL-python # required by ansible
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Amazon'
- mysql-client
- python-mysqldb
- name: Enable and start mysql service
service:
name: mysql
state: restarted
enabled: yes
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Enable and start mysql service
service:
name: mysqld
state: restarted
enabled: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Amazon'
- name: Deletes anonymous MySQL server user for localhost
mysql_user: user="" state="absent" login_password='{{ database_root_passwd }}' login_user=root
- name: Set mysql root password
debconf:
name: mysql-server
question: "mysql-server/{{ item }}"
value: "{{ database_root_passwd | quote }}"
vtype: password
- name: Secures the MySQL root user
mysql_user: user="root" password="{{ database_root_passwd }}" host="{{ item }}" login_password="{{database_root_passwd}}" login_user=root
with_items:
- root_password
- root_password_again
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Reading temporary password
command: bash -c "cat /var/log/mysqld.log | grep \"temporary password\" | sed \"s/.* \\+//g\""
register: tmp_mysql_password
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Amazon'
- 127.0.0.1
- localhost
- ::1
- "{{ ansible_fqdn }}"
- name: Set mysql root password
shell: "/usr/bin/mysqladmin -u root -p\"{{ tmp_mysql_password.stdout }}\" password \"{{ database_root_passwd | quote }}\""
ignore_errors: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Amazon'
- name: Removes the MySQL test database
mysql_db: db=test state=absent login_password="{{ database_root_passwd }}" login_user=root
......@@ -21,6 +21,7 @@
- deb
- deb-src
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Add Nodesource repositories
yum:
name: "https://rpm.nodesource.com/pub_{{ nodejs_major_version }}.x/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm"
......@@ -37,6 +38,7 @@
name: nodejs
state: present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Install NodeJS
yum:
name: nodejs
......
......@@ -468,7 +468,7 @@ function sqlTypeCast(attr) {
break;
case 'datetime':
expandedType = 'DATETIME(3)';
expandedType = 'DATETIME';
break;
case 'time':
......@@ -499,8 +499,7 @@ function toSqlDate(date) {
('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2) + '.' +
('00' + date.getMilliseconds()).slice(-3);
('00' + date.getSeconds()).slice(-2);
return date;
}
......
......@@ -242,8 +242,7 @@ utils.toSqlDate = function toSqlDate(date) {
('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2) + '.' +
('00' + date.getMilliseconds()).slice(-2);
('00' + date.getSeconds()).slice(-2);
return date;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment