From 888fc7ccf092eb7a1ee622450b80e8ad5380933b Mon Sep 17 00:00:00 2001 From: damko Date: Fri, 22 Jan 2016 11:17:01 +0100 Subject: [PATCH 1/2] This fixes this warning with ansible2: _[DEPRECATION WARNING]: Using bare variables for environment is deprecated._ --- tasks/main.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 8aa036c..7fa3a85 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -10,7 +10,7 @@ - name: Install the mysql packages in Debian derivatives apt: name={{ item }} state=installed update_cache=yes with_items: mysql_pkgs - environment: env + environment: "{{ env }}" when: ansible_os_family == 'Debian' - name: Copy the my.cnf file @@ -61,14 +61,12 @@ when: mysql_db|lower() != 'none' - name: Create the database users - mysql_user: name={{ item.name }} password={{ item.pass|default("foobar") }} - priv={{ item.priv|default("*.*:ALL") }} state=present host={{ item.host | default("localhost") }} + mysql_user: name={{ item.name }} password={{ item.pass|default("foobar") }} priv={{ item.priv|default("*.*:ALL") }} state=present host={{ item.host | default("localhost") }} with_items: mysql_users when: mysql_users|lower() != 'none' - name: Create the replication users - mysql_user: name={{ item.name }} host="%" password={{ item.pass|default("foobar") }} - priv=*.*:"REPLICATION SLAVE" state=present + mysql_user: name={{ item.name }} host="%" password={{ item.pass|default("foobar") }} priv=*.*:"REPLICATION SLAVE" state=present with_items: mysql_repl_user when: mysql_repl_role == 'master' From 30ad3b91df3421b64bacbffccf6daca485f704aa Mon Sep 17 00:00:00 2001 From: damko Date: Fri, 22 Jan 2016 11:32:44 +0100 Subject: [PATCH 2/2] This fixes the ansible2 error: _this task 'lineinfile' has extra params, which is only allowed in the following modules: command, shell, script, include, include_vars, add_host, group_by, set_fact, raw, meta_ --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 7fa3a85..1345990 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -77,7 +77,7 @@ when: mysql_repl_role == 'slave' - name: Ensure the hostname entry for master is available for the client. - lineinfile: dest=/etc/hosts regexp="{{ mysql_repl_master }}" line="{{ hostvars[mysql_repl_master].ansible_default_ipv4.address + " " + mysql_repl_master }}" state=present + lineinfile: dest=/etc/hosts regexp='{{ mysql_repl_master }}' line='{{ hostvars[mysql_repl_master].ansible_default_ipv4.address + " " + mysql_repl_master }}' state=present when: slave|failed and mysql_repl_role == 'slave' and mysql_repl_master is defined - name: Get the current master servers replication status