Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loops not supported #41

Open
niftylettuce opened this issue Jul 2, 2020 · 0 comments
Open

Loops not supported #41

niftylettuce opened this issue Jul 2, 2020 · 0 comments

Comments

@niftylettuce
Copy link

This does not work (it will only honor the last ufw_rules block). Thus I just got locked out of a freshly provisioned server:

---
- import_playbook: security.yml hostlist=redis
- hosts: redis
  become: true
  become_user: root
  roles:
    # https://github.com/Oefenweb/ansible-ufw
    - role: ufw
      ufw_rules:
        - rule: allow
          to_port: 22
          protocol: tcp
          comment: ssh
  tasks:
    - name: loop over ufw
      include_role:
        name: ufw
      vars:
        ufw_rules:
          - rule: allow
            to_port: "{{ lookup('env', 'REDIS_PORT') }}"
            from_ip: "{{ item }}"
            protocol: tcp
            comment: "redis access from {{ item }}"
      with_items: "{{ groups['web'] + groups['api'] + groups['bull'] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant