-
Notifications
You must be signed in to change notification settings - Fork 1
/
variables.tf
147 lines (131 loc) · 5.01 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright © 2020 Joseph Wright <joseph@cloudboss.co>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
variable "ansible_config" {
type = any
description = "Variables for configuring Ansible in /etc/ansible/ansible.cfg."
default = {}
}
variable "ansible_directory" {
type = string
description = <<-EOF
This is the directory where Ansible is installed. If `create_ansible_directory` is `true`,
a virtualenv will be created in this directory. The variable `python_requirements` should
also be set to include ansible and other Python dependencies.
If using Ansible installed by a distro package manager, you will most likely want to set
this variable to `/usr` and set `create_ansible_directory` to `false`.
EOF
default = "/opt/ansible"
}
variable "ansible_environment" {
type = map(string)
description = "Environment variables to be defined when running `ansible-playbook`."
default = {}
}
variable "ansible_playbook_roles" {
type = any
description = <<-EOF
The list of Ansible roles and, optionally, their variables to be included in
the playbook.
Ansible is flexible in how this can be defined. It can be a list of maps, each
with a `role` key defining the role's name, along with any arbitrary variables
which are passed to the role. It can also be a list of strings, where each string
is the role name. Variables may also be defined in `ansible_variables`.
Example using maps with variables:
ansible_playbook_roles = [
{
role = "bockerizer"
bockerizer = {
version = "1.2.3"
}
},
{
role = "fooer"
fooer = {
download_url = "https://artifactory.example.com/artifactory/generic/fooer-v4.5.6.zip"
}
}
]
Example without variables:
ansible_playbook_roles = [
"bockerizer",
"fooer",
]
EOF
}
variable "ansible_requirements" {
type = list(map(string))
description = <<-EOF
A list of Ansible roles to be installed into /etc/ansible/roles by the `ansible-galaxy`
command. Normally this should correspond to the roles defined in `ansible_playbook_roles`,
unless roles have been installed ahead of time into the machine image, or if a role is
being used to contain e.g. an Ansble module and does not run tasks. Each map in the list
must be defined according to the following:
https://galaxy.ansible.com/docs/using/installing.html#installing-multiple-roles-from-a-file.
EOF
default = []
}
variable "ansible_variables" {
type = any
description = "Ansible variables to be defined when running `ansible-playbook`."
default = {}
}
variable "create_ansible_directory" {
type = bool
description = <<-EOF
Whether or not to create a virtualenv in which to install Ansible. This requires that
`python_requirements` includes the ansible pip package and any other dependencies.
EOF
default = true
}
variable "python" {
type = string
description = "The name of the python command."
default = "python3"
}
variable "python_repository" {
type = string
description = <<-EOF
A private PyPi repository for retrieving Python packages. If left blank, packages
will be installed from the default public server.
EOF
default = ""
}
variable "python_requirements" {
type = list(string)
description = <<-EOF
Python dependencies, including Ansible, in the format expected by `pip`. It is highly
recommended that you define the package versions in addition to the package names. It
is a good idea to include all dependencies here. The full list dependencies can be
generated by creating a virtualenv, installing your dependencies into it, and then
running `pip freeze`.
Example:
python_requirements = [
"ansible==2.9.10",
"cffi==1.14.0",
"cryptography==2.9.2",
"Jinja2==2.11.2",
"MarkupSafe==1.1.1",
"pycparser==2.20",
"PyYAML==5.3.1",
"six==1.15.0",
]
EOF
default = []
}