Skip to content

Commit e04b257

Browse files
committed
Make Linter happy
1 parent 1095bf5 commit e04b257

File tree

5 files changed

+34
-36
lines changed

5 files changed

+34
-36
lines changed

defaults/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ onion_active: True
44
onion_ipaddr: 127.0.0.1
55
onion_tor_apt_state: present
66
onion_tor_apt_key_id: A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
7-
onion_apt_packages: ['deb.torproject.org-keyring']
7+
onion_apt_packages: ["deb.torproject.org-keyring"]
88
onion_services:
99
ssh:
1010
onion_hostname:

handlers/main.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
# handlers file for onion
32
- name: Restart tor
43
ansible.builtin.systemd:
54
name: tor

tasks/goss.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
32
- name: Check is goss test directory exists
4-
stat:
3+
ansible.builtin.stat:
54
path: "{{ goss_test_directory }}"
65
when: goss_test_directory is defined
76
register: dir
87

98
- name: Copy goss tests
10-
template:
9+
ansible.builtin.template:
1110
src: "test_{{ item }}.yml.j2"
1211
dest: "{{ goss_test_directory }}/test_{{ item }}.yml"
1312
owner: root
1413
group: root
15-
mode: 0644
14+
mode: "0644"
1615
when: dir.stat is defined and dir.stat.exists and dir.stat.isdir
1716
with_items:
1817
- onion

tasks/main.yml

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
---
22
- name: Ensure gpg is present
3-
apt:
3+
ansible.builtin.apt:
44
pkg: gnupg
55
update_cache: True
66

77
- name: Ensure tor is installed
8-
apt:
8+
ansible.builtin.apt:
99
pkg: tor
1010
state: "{{ onion_tor_apt_state }}"
1111

1212
- name: Install extra tor packages
13-
apt:
13+
ansible.builtin.apt:
1414
pkg: "{{ onion_apt_packages }}"
1515
state: present
1616

1717
- name: Ensure onion directory is present
18-
file:
18+
ansible.builtin.file:
1919
path: "/var/lib/tor/{{ item.key }}/"
2020
owner: debian-tor
2121
group: debian-tor
22-
mode: 0700
22+
mode: "0700"
2323
state: directory
2424
with_dict: "{{ onion_services }}"
2525
when: item.value.onion_state|default('present') == 'present'
2626
notify: Restart tor
2727

2828
- name: Ensure onion configuration is latest
29-
template:
29+
ansible.builtin.template:
3030
src: torrc.j2
3131
dest: /etc/tor/torrc
3232
owner: root
@@ -35,12 +35,12 @@
3535
notify: Restart tor
3636

3737
- name: Ensure hostname file are present
38-
template:
38+
ansible.builtin.template:
3939
src: hostname.j2
4040
dest: "/var/lib/tor/{{ item.key }}/hostname"
4141
owner: debian-tor
4242
group: debian-tor
43-
mode: 0600
43+
mode: "0600"
4444
backup: yes
4545
with_dict: "{{ onion_services }}"
4646
when:
@@ -50,9 +50,9 @@
5050
notify: Restart tor
5151

5252
- name: Copy encoded public_key (only for onion v3)
53-
shell:
53+
ansible.builtin.shell:
5454
cmd: "set -o pipefail &&\
55-
echo \"{{ item.value.onion_public_key_b64encoded }}\" | base64 -d >/var/lib/tor/{{ item.key }}/hs_ed25519_public_key"
55+
echo \"{{ item.value.onion_public_key_b64encoded }}\" | base64 -d >/var/lib/tor/{{ item.key }}/hs_ed25519_public_key"
5656
executable: /bin/bash
5757
creates: "/var/lib/tor/{{ item.key }}/hs_ed25519_public_key"
5858
with_dict: "{{ onion_services }}"
@@ -63,7 +63,7 @@ echo \"{{ item.value.onion_public_key_b64encoded }}\" | base64 -d >/var/lib/tor/
6363
notify: Restart tor
6464

6565
- name: Ensure file permissions are correct
66-
file:
66+
ansible.builtin.file:
6767
path: "/var/lib/tor/{{ item.key }}/hs_ed25519_public_key"
6868
owner: debian-tor
6969
group: debian-tor
@@ -75,9 +75,9 @@ echo \"{{ item.value.onion_public_key_b64encoded }}\" | base64 -d >/var/lib/tor/
7575
- item.value.onion_state|default('present') == 'present'
7676

7777
- name: Copy encoded secret_key (only for onion v3)
78-
shell:
78+
ansible.builtin.shell:
7979
cmd: "set -o pipefail &&\
80-
echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/{{ item.key }}/hs_ed25519_secret_key"
80+
echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/{{ item.key }}/hs_ed25519_secret_key"
8181
executable: /bin/bash
8282
creates: "/var/lib/tor/{{ item.key }}/hs_ed25519_secret_key"
8383
with_dict: "{{ onion_services }}"
@@ -88,38 +88,38 @@ echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/
8888
notify: Restart tor
8989

9090
- name: Ensure file permissions are correct
91-
file:
91+
ansible.builtin.file:
9292
path: "/var/lib/tor/{{ item.key }}/hs_ed25519_secret_key"
9393
owner: debian-tor
9494
group: debian-tor
95-
mode: 0600
95+
mode: "0600"
9696
with_dict: "{{ onion_services }}"
9797
when:
9898
- item.value.onion_secret_key_b64encoded is defined
9999
- item.value.onion_secret_key_b64encoded
100100
- item.value.onion_state|default('present') == 'present'
101101

102102
- name: Ensure onion directory is absent
103-
file:
103+
ansible.builtin.file:
104104
path: "/var/lib/tor/{{ item.key }}/"
105-
mode: 0700
105+
mode: "0700"
106106
state: absent
107107
with_dict: "{{ onion_services }}"
108108
when: item.value.onion_state|default('present') == "absent"
109109

110110
# The hostname file won't be created until the tor service
111111
# is restarted, so bounce it before the `wait_for` task.
112112
- name: Flush handlers
113-
meta: flush_handlers
113+
ansible.builtin.meta: flush_handlers
114114

115115
- name: Wait for onion
116-
wait_for:
116+
ansible.builtin.wait_for:
117117
path: "/var/lib/tor/{{ item.key }}/hostname"
118118
with_dict: "{{ onion_services }}"
119119
when: item.value.onion_state|default('present') != "absent"
120120

121121
- name: Read onion url
122-
command: cat "/var/lib/tor/{{ item.key }}/hostname"
122+
ansible.builtin.command: cat "/var/lib/tor/{{ item.key }}/hostname"
123123
register: onion_hostname_results
124124
changed_when: false
125125
with_dict: "{{ onion_services }}"
@@ -128,7 +128,7 @@ echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/
128128
- item.value.onion_state|default('present') != "absent"
129129

130130
- name: Read onion v3 secret key
131-
command: base64 "/var/lib/tor/{{ item.key }}/hs_ed25519_secret_key"
131+
ansible.builtin.command: base64 "/var/lib/tor/{{ item.key }}/hs_ed25519_secret_key"
132132
register: onion_v3_secret_key_results
133133
changed_when: false
134134
with_dict: "{{ onion_services }}"
@@ -137,7 +137,7 @@ echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/
137137
- item.value.onion_state|default('present') != "absent"
138138

139139
- name: Read onion v3 public key
140-
command: base64 "/var/lib/tor/{{ item.key }}/hs_ed25519_public_key"
140+
ansible.builtin.command: base64 "/var/lib/tor/{{ item.key }}/hs_ed25519_public_key"
141141
register: onion_v3_public_key_results
142142
changed_when: false
143143
with_dict: "{{ onion_services }}"
@@ -146,17 +146,17 @@ echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/
146146
- item.value.onion_state|default('present') != "absent"
147147

148148
- name: Display onion url
149-
debug:
149+
ansible.builtin.debug:
150150
msg: >-
151151
{{ lookup('template', role_path + '/templates/display_hostnames.j2') }}
152152
153153
- name: Display public key for v3 host
154-
debug:
154+
ansible.builtin.debug:
155155
msg: >-
156156
{{ lookup('template', role_path + '/templates/display_v3_public_keys.j2') }}
157157
158158
- name: Display secret key for v3 host
159-
debug:
159+
ansible.builtin.debug:
160160
msg: >-
161161
{{ lookup('template', role_path + '/templates/display_v3_secret_keys.j2') }}
162162
@@ -172,10 +172,10 @@ echo \"{{ item.value.onion_secret_key_b64encoded }}\" | base64 -d >/var/lib/tor/
172172
when: not onion_active
173173

174174
- name: Import monit tasks
175-
import_tasks: monit.yml
175+
ansible.builtin.import_tasks: monit.yml
176176
when: onion_monit_enabled
177177

178178
- name: Import goss tasks
179-
import_tasks: goss.yml
179+
ansible.builtin.import_tasks: goss.yml
180180
tags:
181181
- goss

tasks/monit.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
- name: Ensure monit configs are present
3-
copy:
3+
ansible.builtin.copy:
44
src: "monit/conf.d/{{ item }}"
55
dest: "/etc/monit/conf.d/{{ item }}"
66
owner: root
77
group: root
8-
mode: 0600
8+
mode: "0600"
99
with_items:
1010
- tor
11-
notify: restart monit
11+
notify: Restart monit

0 commit comments

Comments
 (0)