Answer the question
In order to leave comments, you need to log in
How to make ansible enums in playbook?
Hello.
How to make enumerations in ansible: attributes?
For example:
I want to open an RDP port on Windows for multiple IPs
- name: Firewall rule to allow RDP on TCP port 3389
win_firewall_rule:
name: Remote Desktop
localport: 3389
action: allow
direction: in
protocol: tcp
profiles: private
remoteip: '"1.1 .1.1.", "2.2.2.2'
state: present
enabled: yes
Or open multiple ports at once:
- name: Firewall rule to allow RDP on TCP port 3389
win_firewall_rule:
name: Remote Desktop
localport: ['3389', '21' ]
action: allow
direction
: in protocol
:
tcp
profiles
: private
state: present
enabled:
yes 23 "'
Help, please. How to do it right?
Answer the question
In order to leave comments, you need to log in
An example from my playbook. Might fit.
- name: 'Default configs Apache2 & PHP'
template: 'src={{item.src}} dest={{item.dest}} backup=yes'
with_items:
- { src: 'templates/apache2/000-default.conf.j2', dest: '/etc/apache2/sites-available/000-default.conf' }
- { src: 'templates/php/7.0/cli/php.ini.j2', dest: '/etc/php/7.0/cli/php.ini' }
- { src: 'templates/php/7.0/apache2/php.ini.j2', dest: '/etc/php/7.0/apache2/php.ini' }
notify:
- 'apache2 reload'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question