Ansible variable question.

Hi ,

I have a variable declared as shown below. When the playbook run, the two tasks shown below are skipped. Can someone please clarify the best practice to declare the variable and use as detailed below.

mariadb_version: 10.1

  • name: Start MariaDB 10.0
    service: name=mysql enabled=yes state=started
    when: mariadb_version == ‘10.0’

  • name: Start MariaDB 10.1
    service: name=mariadb enabled=yes state=started
    when: mariadb_version == ‘10.1’

Thanks

Change this:
mariadb_version: 10.1

into this:

mariadb_version: "10.1"

- name: Start MariaDB 10.0
   service: name=mysql enabled=yes state=started
   when: mariadb_version == '10.0'

- name: Start MariaDB 10.1
   service: name=mariadb enabled=yes state=started
   when: mariadb_version == '10.1'

Then the second task should work.

Johannes