-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresttags02.yml
More file actions
37 lines (32 loc) · 1.04 KB
/
resttags02.yml
File metadata and controls
37 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: Ansible rest and tags
hosts: localhost
gather_facts: false
## Lookup plugins can be used anywhere you can use templating in Ansible-
## in a play, in variables files, or in Jinja2 templates for the template
## module
vars:
myrsakey: "{{ lookup('file', '/home/student/.ssh/id_rsa.pub') }}"
astros: "{{ lookup('url', 'http://api.open-notify.org/astros.json') }}"
## Tags are easy! ansible-playbook example.yml --tags "keytime,astros" # would run everything
## ansible-playbook example.yml --tags "astros" # would NOT run the task named 'Key prep'
tasks:
- name: Key prep
debug:
msg: "Your RSA key is {{ myrsakey }}"
tags:
- keytime
- vmprep
- name: Quick ISS API checkup
debug:
msg: "Today on the ISS are: {{ astros.people }}"
tags:
- jsonwork
- astros
- name: Clean up that ISS data
debug:
msg: "Let me format that with a loop: {{ item }}"
loop: "{{ astros.people|map(attribute='name')|list }}"
tags:
- jsonwork
- astros