File tree 4 files changed +81
-2
lines changed
4 files changed +81
-2
lines changed Original file line number Diff line number Diff line change @@ -47,15 +47,15 @@ def file_exists(stat_result):
47
47
48
48
49
49
def parse_a2query (stdout ):
50
- """Parse out the first column from a2query STDOUT lines."""
50
+ """Parse the first column from a2query STDOUT lines."""
51
51
if not stdout :
52
52
return stdout
53
53
54
54
return [line .split (" " )[0 ] for line in stdout ]
55
55
56
56
57
57
def to_vhost_filename (vhost ):
58
- """Turn vhost into filename."""
58
+ """Turn apache_vhost item(dict) into a filename."""
59
59
try :
60
60
priority = int (vhost .get ("priority" , 25 ))
61
61
if "ssl" in vhost and vhost ["ssl" ]:
Original file line number Diff line number Diff line change
1
+ ---
2
+ DOCUMENTATION :
3
+ name : file_exists
4
+ version_added : " 1.0"
5
+ short_description : evaluate results of stat
6
+ description :
7
+ - Evaluate results of ansible.builtin.stat.
8
+ - Returns True if file is either regular file or symlink.
9
+ positional : _input
10
+ options :
11
+ _input :
12
+ description : Value returned by ansible.builtin.stat.
13
+ type : dict
14
+ required : true
15
+
16
+ EXAMPLES : |
17
+ - name: Check if SSL certificate exists
18
+ ansible.builtin.stat:
19
+ path: "/path/to/ssl.cert"
20
+ register: _stat_ssl_cert
21
+
22
+ - name: Does SSL cert file exist?
23
+ ansible.builtin.debug:
24
+ msg: "No, it does not"
25
+ when: >
26
+ _stat_ssl_cert is not defined
27
+ or _stat_ssl_cert | file_exists is false
28
+
29
+ RETURN :
30
+ _value :
31
+ description : True if file is either regular file or symlink.
32
+ type : bool
Original file line number Diff line number Diff line change
1
+ ---
2
+ DOCUMENTATION :
3
+ name : parse_a2query
4
+ version_added : " 1.0"
5
+ short_description : parse first column from a2query output
6
+ description :
7
+ - Parse the first column from a2query STDOUT lines.
8
+ positional : _input
9
+ options :
10
+ _input :
11
+ description : a2query's STDOUT.
12
+ type : str
13
+ required : true
14
+
15
+ EXAMPLES : |
16
+ - name: Parse first column from a2query's stdout lines.
17
+ ansible.builtin.set_fact:
18
+ myvar: "{{ _apache_cmd_a2q.stdout_lines | parse_a2query }}"
19
+
20
+ RETURN :
21
+ _value :
22
+ description : Fist column of a2query as a list.
23
+ type : list
24
+ elements : str
Original file line number Diff line number Diff line change
1
+ ---
2
+ DOCUMENTATION :
3
+ name : to_vhost_filename
4
+ version_added : " 1.0"
5
+ short_description : turn apache_vhost item into filename.
6
+ description :
7
+ - Assemble filename(used to store vhost config) from item in apache_vhosts.
8
+ positional : _input
9
+ options :
10
+ _input :
11
+ description : apache_vhost item.
12
+ type : dict
13
+ required : true
14
+
15
+ EXAMPLES : |
16
+ - name: Get virtual host's filename.
17
+ ansible.builtin.set_fact:
18
+ apache_vhost_filename: "{{ apache_vhosts[0] | to_vhost_filename }}"
19
+
20
+ RETURN :
21
+ _value :
22
+ description : filename of given virtual host.
23
+ type : str
You can’t perform that action at this time.
0 commit comments