Ansible hot add multiple ports -


ansible playbook

how add multiple ports (interactive prompt) using firewall-cmd command in ansible-playbook

vars_prompt:      - name: port      prompt: "enter port#"      private: no 

i can 1 port not multiple ports

vars_prompt "loops" not possible (as of ansible 2.3) without writing custom plugins.

you can workaround expecting comma-separated string , split later list:

- hosts: localhost   gather_facts: no   vars_prompt:     - name: ports       prompt: "enter port(s) number"       private: no   tasks:     - name: add port       shell: /bin/firewall-cmd --permanent --add-port={{ item }}/tcp       with_items: "{{ ports.split(',') }}" 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -