Skip to content

Instantly share code, notes, and snippets.

@vterdunov
Last active March 1, 2016 16:13
Show Gist options
  • Save vterdunov/f8e0635a008e1fc7ba50 to your computer and use it in GitHub Desktop.
Save vterdunov/f8e0635a008e1fc7ba50 to your computer and use it in GitHub Desktop.
вариант запускать сервисы от колличества ядер без генерации хэша
- hosts: localhost
vars:
myhashes:
service_name: service
port: 8085
env: production
tasks:
- name: test
debug: msg="service {{ myhashes['service_name']+item }} port {{ myhashes['port']+item | int }}"
with_sequence: count={{ ansible_processor_vcpus }}
вывод:
TASK: [test] ******************************************************************
ok: [localhost] => (item=1) => {
"item": "1",
"msg": "service service1 port 8086"
}
ok: [localhost] => (item=2) => {
"item": "2",
"msg": "service service2 port 8087"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment