diff --git a/Vagrantfile b/Vagrantfile index f9c3fe9..61b11cf 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -39,7 +39,7 @@ Vagrant.configure(2) do |config| # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" - #config.vm.synced_folder "ansible", "/root" + #config.vm.synced_folder "ansible", "/vagrant" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. @@ -73,6 +73,7 @@ Vagrant.configure(2) do |config| config.vm.provision "ansible" do |ansible| ansible.playbook = "ansible/ispmail.yml" + #ansible.playbook = "ispmail.yml" ansible.become = true #ansible.become_user = 'root' ansible.compatibility_mode = '2.0' @@ -97,4 +98,3 @@ Vagrant.configure(2) do |config| # Submission config.vm.network "forwarded_port", guest: 587, host: 10587 end - diff --git a/ansible/roles/ispmail-database/tasks/main.yml b/ansible/roles/ispmail-database/tasks/main.yml index c536062..633a278 100644 --- a/ansible/roles/ispmail-database/tasks/main.yml +++ b/ansible/roles/ispmail-database/tasks/main.yml @@ -1,15 +1,27 @@ --- - name: Installing required Python mysqldb module for Ansible to manage databases +# apt: name=python-mysqldb apt: name=python-pymysql -- name: Set root user password - become: true - # If .my.cnf already exists, this will cause an mysql-root-password update. +# - name: Set root user password +# become: true +# # If .my.cnf already exists, this will cause an mysql-root-password update. +# mysql_user: +# name: root +# password: "{{ ispmail_mysql_root_password}}" +# login_unix_socket: /var/run/mysqld/mysqld.sock +# check_implicit_admin: true + +- name: Set a new root password mysql_user: - name: root - password: "{{ ispmail_mysql_root_password}}" + check_implicit_admin: yes + user: root + password: "{{ ispmail_mysql_root_password }}" login_unix_socket: /var/run/mysqld/mysqld.sock - check_implicit_admin: true + host: "{{ item }}" + with_items: + - localhost + - 127.0.0.1 - name: Create .my.cnf template: diff --git a/ansible/roles/ispmail-database/templates/root-my-cnf.j2 b/ansible/roles/ispmail-database/templates/root-my-cnf.j2 index c1f9c78..967cecb 100644 --- a/ansible/roles/ispmail-database/templates/root-my-cnf.j2 +++ b/ansible/roles/ispmail-database/templates/root-my-cnf.j2 @@ -1,3 +1,4 @@ [client] user=root password={{ispmail_mysql_root_password}} +socket=/var/run/mysqld/mysqld.sock