LoginSignup
0
0

More than 5 years have passed since last update.

inventoryに書かれたホスト名を渡す

Last updated at Posted at 2018-10-20

inventory に書かれたホスト名を使ってシェルを実行したいときに。

inventory.
[group1]
g1-1
g1-2

[group2]
g2-1
g2-2

[group3]
g3-1
g3-2
g3-3

[servers:children]
group1

[nw:children]
group2
group3
site.yml
---
- hosts: 127.0.0.1
  tasks:
  - name: execute touch
    shell: touch /var/tmp/{{ item }}
    with_items:
      - "{{ groups['all'] }}"                                                                                                 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0