mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-25 02:31:51 +00:00
Factoids and push variables via setup are now available to be templated in command args
as well as template files. PLUS, variables are now expressed in playbooks without having to know about the setup task, which means playbooks are simpler to read now.
This commit is contained in:
parent
e0b1ad790c
commit
8d57ceecf1
7 changed files with 81 additions and 19 deletions
|
|
@ -1,15 +1,18 @@
|
|||
---
|
||||
- hosts: all
|
||||
user: root
|
||||
vars:
|
||||
http_port: 80
|
||||
max_clients: 200
|
||||
tasks:
|
||||
- include: base.yml
|
||||
- name: configure template & module variables for future template calls
|
||||
action: setup http_port=80 max_clients=200
|
||||
- name: write the apache config file
|
||||
- name: write the apache config file using vars set above
|
||||
action: template src=/srv/httpd.j2 dest=/etc/httpd.conf
|
||||
notify:
|
||||
- restart apache
|
||||
- name: ensure apache is running
|
||||
action: service name=httpd state=started
|
||||
- name: pointless test action
|
||||
action: command /bin/echo {{ http_port }}
|
||||
handlers:
|
||||
- include: handlers.yml
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
---
|
||||
- hosts: '*'
|
||||
vars:
|
||||
a: 2
|
||||
b: 3
|
||||
c: 4
|
||||
tasks:
|
||||
- name: config step
|
||||
action: setup a=2 b=3 c=4
|
||||
- name: copy comand
|
||||
action: copy src=/srv/a dest=/srv/b
|
||||
notify:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue