1
- bellackn.proxmox_lxc
2
- ===============
1
+ # bellackn.proxmox_lxc
3
2
4
3
> This role used to be called bellackn.px_lxc and was renamed as part of [ #1 ] ( https://github.com/bellackn/ansible-role-proxmox-lxc/issues/1 ) .
5
4
6
5
This role is a convenient wrapper for the Ansible Proxmox community module and can be used to create or delete LXCs on a
7
6
Proxmox instance.
8
7
9
- How to Use
10
- ----------
8
+ ## How to Use
11
9
12
10
The role bases upon the ` proxmox_lxc_containers_present ` and ` proxmox_lxc_containers_absent ` variables to
13
- spawn or delete LXCs. You can put a list of LXCs into these variables; the list items use the same keys like the
11
+ spawn or delete LXCs. You can put a list of LXCs into these variables; the list items use the same keys like the
14
12
[ Proxmox community module] [ 1 ] . There are a lot of sane default values for most of the possible settings, but you can
15
13
override each of them, either on a global level by overriding the default ` proxmox_lxc_* ` variable, or for a specific
16
- container by passing the variable into ` proxmox_lxc_containers_present ` - just check the example playbook (the ` cpus `
14
+ container by passing the variable into ` proxmox_lxc_containers_present ` - just check the example playbook (the ` cpus `
17
15
part) and you'll get the idea.
18
16
19
- Requirements
20
- ------------
17
+ ## Requirements
21
18
22
19
You need to have the following installed on your controlhost:
23
- * Ansible Role ` geerlingguy.pip `
24
- * Dependency to ensure that ` pip ` is present to install the required ` proxmoxer ` package
25
- * Ansible Collection ` community.general `
26
- * Contains the ` community.general.proxmox ` module, the centerpiece of this role
27
20
28
- Role Variables
29
- --------------
21
+ - Ansible Role ` geerlingguy.pip `
22
+ - Dependency to ensure that ` pip ` is present to install the required ` proxmoxer ` package
23
+ - Ansible Collection ` community.general `
24
+ - Contains the ` community.general.proxmox ` module, the centerpiece of this role
25
+
26
+ ## Role Variables
30
27
31
28
### Mandatory
32
29
@@ -64,7 +61,7 @@ need the logs for debugging though. Set this to `false` then.
64
61
proxmox_lxc_containers_present: []
65
62
proxmox_lxc_containers_absent: []
66
63
67
- Takes a list of LXCs that you either want to ** create** or to ** delete** . See the [ Proxmox community module] [ 1 ] for all
64
+ Takes a list of LXCs that you either want to ** create** or to ** delete** . See the [ Proxmox community module] [ 1 ] for all
68
65
possible variables and check the example playbook. For the absent container list, passing the hostname is enough.
69
66
70
67
(Although these are optional, not defining any of them makes the role pretty much pointless.)
@@ -84,7 +81,7 @@ that it has within the Proxmox cluster (see [#4](https://github.com/bellackn/ans
84
81
proxmox_lxc_cpus: 1
85
82
proxmox_lxc_cpuunits: 1000
86
83
proxmox_lxc_description: Created with Ansible
87
- proxmox_lxc_disk: 3
84
+ proxmox_lxc_disk: local-lvm: 3
88
85
proxmox_lxc_features: []
89
86
proxmox_lxc_force: no
90
87
proxmox_lxc_hookscript: ""
@@ -95,7 +92,6 @@ that it has within the Proxmox cluster (see [#4](https://github.com/bellackn/ans
95
92
proxmox_lxc_pool: ""
96
93
proxmox_lxc_pubkey: ""
97
94
proxmox_lxc_searchdomain: ""
98
- proxmox_lxc_storage: local
99
95
proxmox_lxc_swap: 0
100
96
proxmox_lxc_timeout: 30
101
97
proxmox_lxc_unprivileged: no
@@ -125,8 +121,7 @@ Seconds to wait for the LXC to be started.
125
121
You can specify the VMID for the container that you want to create. If you don't set this, the next available ID will
126
122
be automatically picked. If the specified ID is already taken, the play will fail.
127
123
128
- Example Playbook
129
- ----------------
124
+ ## Example Playbook
130
125
131
126
This playbook will create two Ubuntu LXCs and delete them afterwards.
132
127
@@ -139,7 +134,6 @@ This playbook will create two Ubuntu LXCs and delete them afterwards.
139
134
proxmox_lxc_api_host: proxmox
140
135
proxmox_lxc_api_user: root@pam
141
136
proxmox_lxc_api_password: s3cr3t!
142
- proxmox_lxc_storage: local-lvm
143
137
proxmox_lxc_cpus: 2 # Specify the value for all LXCs created with this role
144
138
145
139
proxmox_lxc_containers_present:
@@ -153,32 +147,28 @@ This playbook will create two Ubuntu LXCs and delete them afterwards.
153
147
cpus: 2 # Use a value specifically for this LXC
154
148
ostemplate: local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz
155
149
password: baaar
156
-
150
+
157
151
proxmox_lxc_containers_absent:
158
152
- hostname: test1
159
153
- hostname: test2
160
-
154
+
161
155
roles:
162
156
- bellackn.homelab.proxmox_lxc
163
157
164
- Known Limitations
165
- -----------------
158
+ ## Known Limitations
166
159
167
- * It's currently not possible to authenticate with Proxmox using API tokens, you have to use user/password.
168
- * Deleting containers must happen by specifying its hostname, deleting by VMID is not yet possible.
160
+ - It's not possible to authenticate with Proxmox using API tokens, you have to use user/password.
161
+ - Deleting containers must happen by specifying its hostname, deleting by VMID is not possible.
169
162
170
- License
171
- -------
163
+ ## License
172
164
173
165
MIT
174
166
175
- Author Information
176
- ------------------
167
+ ## Author Information
177
168
178
169
[ Nico Bellack
] ( mailto:[email protected] )
179
170
180
- Acknowledgements
181
- ----------------
171
+ ## Acknowledgements
182
172
183
173
This role was heavily inspired by the [ ovv.lxc] ( https://github.com/ovv/ansible-role-proxmox-lxc ) role. Thank you!
184
174
0 commit comments