![]() 'Email': '',Įxecution result of this playbook would be as follows ➜ ansible-playbook Dict. In the following playbook, you can see that we have created a dictionary named mydict and stored some key-value data and displaying it using the debug statement - name: Dictionary playbook example you can place your dictionary variable under the vars segment of your playbook like this You can declare and create a dictionary using the normal variable declaration methodology of Ansible. Creating a Dictionary under vars section in Ansible There are multiple ways to create a dictionary in ansible and we would be seeing all of them with examples. I am sure, if you are here then you must have an idea about dictionaries anyway. Hope the following picture would give a quick idea about the dictionaries. The difference between a list(array) and a dictionary is in the dictionary every value has a name(key) and not indexed by their positional values like 0,1,2 etc in Perl, it used to be called as hashĭictionaries are a collection of key: value data sets. Especially python dictionaries because Ansible is pythonic and the word dictionary was introduced in python. In this post, we are going to see how to create a dictionary in ansible during the playbook execution dynamically and how to add items or elements to a dictionary.īefore going further, let us refresh our memory of knowledge on the dictionaries.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |