Skip to content

Commit

Permalink
Update vars to have the role name as a prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Apr 15, 2024
1 parent a66deb8 commit 9f00fec
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/postgres/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: Restart postgres.
service:
name: '{{ postgresql_daemon }}'
name: '{{ postgres_daemon }}'
state: "restarted"
14 changes: 7 additions & 7 deletions ansible/roles/postgres/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
apt:
name:
- python3-psycopg2
- postgresql-{{ postgresql_version }}
- postgresql-contrib-{{ postgresql_version }}
- postgresql-{{ postgres_version }}
- postgresql-contrib-{{ postgres_version }}
- libpq-dev
state: present
tags:
- role::postgres

- name: Check postgres is started and enabled on boot
service:
name: '{{ postgresql_daemon }}'
name: '{{ postgres_daemon }}'
state: started
enabled: true
tags:
- role::postgres

- name: Add postgres users
community.postgresql.postgresql_user: "{{ item }}"
with_items: "{{ postgresql_users }}"
with_items: "{{ postgres_users }}"
become: true
become_user: "{{ postgresql_user }}"
become_user: "{{ postgres_user }}"
tags:
- role::postgres

- name: Add postgres databases
community.postgresql.postgresql_db: "{{ item }}"
with_items: "{{ postgresql_databases }}"
with_items: "{{ postgres_databases }}"
become: true
become_user: "{{ postgresql_user }}"
become_user: "{{ postgres_user }}"
tags:
- role::postgres
8 changes: 4 additions & 4 deletions ansible/roles/postgres/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
postgresql_version: "15"
postgresql_daemon: "postgresql@{{ postgresql_version }}-main"
postgres_version: "15"
postgres_daemon: "postgresql@{{ postgres_version }}-main"
postgres_user: "postgres"

postgresql_users: []
postgres_users: []

postgresql_databases: []
postgres_databases: []
2 changes: 1 addition & 1 deletion ansible/roles/ufw/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@

- name: Apply service-specific rules
community.general.ufw: "{{ item }}"
with_items: "{{ rules }}"
with_items: "{{ ufw_rules }}"
tags:
- role::ufw
2 changes: 1 addition & 1 deletion ansible/roles/ufw/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rules:
ufw_rules:
- comment: Allow internal traffic
interface: wg0
direction: in
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/wireguard/defaults/main/vars.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extra_keys:
wireguard_extra_keys:
- name: Joe
pubkey: /dJ+tKXzxv7nrUleNlF+CGyq7OIVlqL8/9Sn8j+cEAc=
subnet: 10.0.1.0/24
2 changes: 1 addition & 1 deletion ansible/roles/wireguard/templates/wg0.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PersistentKeepalive = 30

{% endfor %}

{% for key in extra_keys %}
{% for key in wireguard_extra_keys %}
# DevOps config for: {{ key.name }}
[Peer]
AllowedIPs = {{ key.subnet }}
Expand Down

0 comments on commit 9f00fec

Please sign in to comment.