Hello Anyone here can guide me on Ansible ?
I have created a role for AEM(Adobe Experience Manager) Author and Publisher. They both have exact same instructions however as per role their variables do change. One server per role. One server cannot have two roles.
Variable values are to be dictated by tag. We have two or more VM's but Ansible code should grab the value of the variable depending on tag. Has anyone done this before? If yes a code snippet or article would be appreciated.
Example code snippet is below:
- name: Create mnt directory structure
file:
path: /mnt/{{ item }}
state: directory
owner: cq5
group: cq5
mode: 775
with_items:
- crx
- crx/author
- crx/publish
tags:
- aem_author
- aem_publish
- name: Copy License file on Author
copy:
src: license.properties
dest: "{{ item }}"
owner: cq5
group: cq5
mode: 755
force: yes
loop:
- "{{ author_folder }}"
- "{{ publishe_folder }}"
tags:
- aem_author
- aem_publish
So as you see in the above snippet, looping variables should be fed as per server. If no tag is given then it should feed in the variable and in fact skip it.
Is this possible at all?
Thanks and Regards,
Ameya Agashe