I am trying to check the distribution of a box I am deploying to with ansible. I have a database that has something like "ubuntu lucid" in a column for distro and I want to check both the distribution ansible_distribution
and ansible_distribution_release
. Is there a way to either concatenate those two strings to match them against my database value or to split the database value in the ansible role?
I am referencing the documentation here
答案 0 :(得分:2)
You can concatenate vars with Jinja variable expansion:
"{{ ansible_distribution }}{{ ansible_distribution_release }}"
or split your database var with:
- name: Database var converted to a list
debug: var="{{ item }}"
with_items: "database_var.split(' ')"