Ansible variable question.

15 views
Skip to first unread message

Jason Morgan

unread,
Jan 25, 2017, 3:33:25 PM1/25/17
to Ansible Project
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

Johannes Kastl

unread,
Jan 25, 2017, 3:40:26 PM1/25/17
to ansible...@googlegroups.com
On 25.01.17 21:33 'Jason Morgan' via Ansible Project wrote:

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


signature.asc
Reply all
Reply to author
Forward
0 new messages