Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####### first, define two roles, red and blue, each which
- ####### define the variable color to be, well, red or blue.
- ==> roles/red/tasks/main.yml <==
- - name: red test
- command: echo $color
- ==> roles/red/vars/main.yml <==
- color: red
- ==> roles/blue/tasks/main.yml <==
- - name: blue test
- command: echo $color
- ==> roles/blue/vars/main.yml <==
- color: blue
- ######## define a playbook with the two roles
- [bowe@catbus ansible]$ head color.yml
- - hosts: localhost
- roles:
- - red
- - blue
- ######## and run it. Both commands echo 'blue' :(.
- [bowe@catbus ansible]$ ANSIBLE_NOCOWS=1 ansible-playbook -v color.yml
- PLAY [localhost] **************************************************************
- GATHERING FACTS ***************************************************************
- ok: [localhost]
- TASK: [red test] **************************************************************
- changed: [localhost] => {"changed": true, "cmd": ["echo", "blue"], "delta": "0:00:00.001402", "end": "2013-08-03 15:41:52.397388", "item": "", "rc": 0, "start": "2013-08-03 15:41:52.395986", "stderr": "", "stdout": "blue"}
- TASK: [blue test] *************************************************************
- changed: [localhost] => {"changed": true, "cmd": ["echo", "blue"], "delta": "0:00:00.003406", "end": "2013-08-03 15:41:52.718623", "item": "", "rc": 0, "start": "2013-08-03 15:41:52.715217", "stderr": "", "stdout": "blue"}
- PLAY RECAP ********************************************************************
- localhost : ok=3 changed=2 unreachable=0 failed=0
Advertisement
Add Comment
Please, Sign In to add comment