Skip to content

Commit 2c98a0c

Browse files
committed
Release 1.6.2
Merge branch 'develop' into master
2 parents f85ec2f + 71b1212 commit 2c98a0c

22 files changed

+358
-210
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
*.*~*
33
*.bak
44

5-
ansible.cfg
5+
/ansible.cfg
66
*.retry
77
/.project
88
/.pydevproject
9+
10+
fetch/
11+
.vagrant/

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
install:
1616
- if [ "$ANSIBLE_GIT_VERSION" ]; then pip install "https://github.com/ansible/ansible/archive/${ANSIBLE_GIT_VERSION}.tar.gz";
1717
else pip install "ansible${ANSIBLE_VERSION}"; fi;
18-
pip install --pre ansible-lint; pip install jmespath
18+
pip install --pre ansible-lint; pip install jmespath netaddr
1919
- ansible --version
2020
- ansible-galaxy install lae.travis-lxc,v0.8.1
2121
- ansible-playbook tests/install.yml -i tests/inventory
@@ -25,11 +25,11 @@ before_script: cd tests/
2525
script:
2626
- ansible-lint ../ || true
2727
- ansible-playbook -i inventory deploy.yml --syntax-check
28-
- ansible-playbook -i inventory -v deploy.yml --skip skiponlxc
29-
- 'ANSIBLE_STDOUT_CALLBACK=debug unbuffer ansible-playbook --skip skiponlxc -vv
30-
-i inventory deploy.yml > idempotency.log 2>&1 || (e=$?; cat idempotency.log; exit $e)'
28+
- 'ansible-playbook -i inventory -v deploy.yml --skip skiponlxc & pid=$!; { while true; do sleep 1; kill -0 $pid 2>/dev/null || break; printf "\0"; done }'
29+
- 'ANSIBLE_STDOUT_CALLBACK=debug ANSIBLE_DISPLAY_SKIPPED_HOSTS=no ANSIBLE_DISPLAY_OK_HOSTS=no
30+
unbuffer ansible-playbook --skip skiponlxc -vv -i inventory deploy.yml &> idempotency.log'
3131
- 'grep -A1 "PLAY RECAP" idempotency.log | grep -qP "changed=0 .*failed=0 .*" &&
32-
(echo "Idempotence: PASS"; exit 0) || (echo "Idempotence: FAIL"; exit 1)'
32+
(echo "Idempotence: PASS"; exit 0) || (echo "Idempotence: FAIL"; cat idempotency.log; exit 1)'
3333
- ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook -i inventory -v test.yml
3434
notifications:
3535
webhooks:

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ For example:
340340
This will ask for a sudo password, then login to the `admin1` user (using public
341341
key auth - add `-k` for pw) and run the playbook.
342342

343-
That's it! You should now have a fully deployed Proxmox cluster. You may want to
344-
create Ceph storage on it afterward, which this role does not (yet?) do, and
345-
other tasks possibly, but the hard part is mostly complete.
343+
That's it! You should now have a fully deployed Proxmox cluster. You may want
344+
to create Ceph storage on it afterwards (see Ceph for more info) and other
345+
tasks possibly, but the hard part is mostly complete.
346346

347347

348348
## Example Playbook
@@ -394,7 +394,8 @@ pve_zfs_enabled: no # Specifies whether or not to install and configure ZFS pack
394394
# pve_zfs_zed_email: "" # Should be set to an email to receive ZFS notifications
395395
pve_ceph_enabled: false # Specifies wheter or not to install and configure Ceph packages. See below for an example configuration.
396396
pve_ceph_repository_line: "deb http://download.proxmox.com/debian/ceph-nautilus buster main" # apt-repository configuration. Will be automatically set for 5.x and 6.x (Further information: https://pve.proxmox.com/wiki/Package_Repositories)
397-
pve_ceph_network: "{{ (ansible_default_ipv4.network +'/'+ ansible_default_ipv4.netmask) | ipaddr('net') }}" # Ceph cluster network
397+
pve_ceph_network: "{{ (ansible_default_ipv4.network +'/'+ ansible_default_ipv4.netmask) | ipaddr('net') }}" # Ceph public network
398+
# pve_ceph_cluster_network: "" # Optional, if the ceph cluster network is different from the public network (see https://pve.proxmox.com/pve-docs/chapter-pveceph.html#pve_ceph_install_wizard)
398399
pve_ceph_mon_group: "{{ pve_group }}" # Host group containing all Ceph monitor hosts
399400
pve_ceph_mds_group: "{{ pve_group }}" # Host group containing all Ceph metadata server hosts
400401
pve_ceph_osds: [] # List of OSD disks
@@ -417,18 +418,18 @@ pve_cluster_enabled: no # Set this to yes to configure hosts to be clustered tog
417418
pve_cluster_clustername: "{{ pve_group }}" # Should be set to the name of the PVE cluster
418419
```
419420

420-
Information about the following can be found in the PVE Documentation in the
421-
[Cluster Manager][pvecm-network] chapter.
421+
The following variables are used to provide networking information to corosync.
422+
These are known as ring0_addr/ring1_addr or link0_addr/link1_addr, depending on
423+
PVE version. They should be IPv4 or IPv6 addresses. For more information, refer
424+
to the [Cluster Manager][pvecm-network] chapter in the PVE Documentation.
422425

423426
```
424-
pve_cluster_ring0_addr: "{{ ansible_default_ipv4.address }}"
425-
pve_cluster_bindnet0_addr: "{{ pve_cluster_ring0_addr }}"
426-
# pve_cluster_ring1_addr: "another interface's IP address or hostname"
427-
# pve_cluster_bindnet1_addr: "{{ pve_cluster_ring1_addr }}"
428-
427+
# pve_cluster_addr0: "{{ ansible_default_ipv4.address }}"
428+
# pve_cluster_addr1: "another interface's IP address or hostname"
429429
```
430430

431431
You can set options in the datacenter.cfg configuration file:
432+
432433
```
433434
pve_datacenter_cfg:
434435
keyboard: en-us
@@ -553,11 +554,22 @@ documentation.
553554

554555
## Ceph configuration
555556

557+
*This section could use a little more love. If you are actively using this role
558+
to manage your PVE Ceph cluster, please feel free to flesh this section more
559+
thoroughly and open a pull request! See issue #68.*
560+
561+
**PVE Ceph management with this role is experimental.** While users have
562+
successfully used this role to deploy PVE Ceph, it is not fully tested in CI
563+
(due to a lack of usable block devices to use as OSDs in Travis CI). Please
564+
deploy a test environment with your configuration first prior to prod, and
565+
report any issues if you run into any.
566+
556567
This role can configure the Ceph storage system on your Proxmox hosts.
557568

558569
```
559570
pve_ceph_enabled: true
560571
pve_ceph_network: '172.10.0.0/24'
572+
pve_ceph_cluster_network: '172.10.1.0/24'
561573
pve_ceph_osds:
562574
# OSD with everything on the same device
563575
- device: /dev/sdc
@@ -592,15 +604,21 @@ pve_ceph_fs:
592604
mountpoint: /srv/proxmox/backup
593605
```
594606

607+
`pve_ceph_network` by default uses the `ipaddr` filter, which requires the
608+
`netaddr` library to be installed and usable by your Ansible controller.
609+
595610
## Contributors
596611

597-
Musee Ullah ([@lae](https://github.com/lae), <[email protected]>)
612+
Musee Ullah ([@lae](https://github.com/lae), <[email protected]>) - Main developer
613+
Fabien Brachere ([@Fbrachere](https://github.com/Fbrachere)) - Storage config support
614+
Gaudenz Steinlin ([@gaundez](https://github.com/gaudenz)) - Ceph support, etc
615+
Thoralf Rickert-Wendt ([@trickert76](https://github.com/trickert76)) - PVE 6.x support, etc
598616
Engin Dumlu ([@roadrunner](https://github.com/roadrunner))
599617
Jonas Meurer ([@mejo-](https://github.com/mejo-))
600-
Ondrej Flider ([@SniperCZE](https://github.com/SniperCZE))
618+
Ondrej Flidr ([@SniperCZE](https://github.com/SniperCZE))
601619
niko2 ([@niko2](https://github.com/niko2))
602620
Christian Aublet ([@caublet](https://github.com/caublet))
603-
Fabien Brachere ([@Fbrachere](https://github.com/Fbrachere))
621+
Michael Holasek ([@mholasek](https://github.com/mholasek))
604622

605623
[pve-cluster]: https://pve.proxmox.com/wiki/Cluster_Manager
606624
[install-ansible]: http://docs.ansible.com/ansible/intro_installation.html

Vagrantfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Vagrant.configure("2") do |config|
2+
config.vm.box = "debian/buster64"
3+
4+
config.vm.provider :libvirt do |libvirt|
5+
libvirt.memory = 2048
6+
libvirt.cpus = 2
7+
end
8+
9+
N = 3
10+
(1..N).each do |machine_id|
11+
config.vm.define "pve-#{machine_id}" do |machine|
12+
machine.vm.hostname = "pve-#{machine_id}"
13+
14+
if machine_id == N
15+
machine.vm.provision :ansible do |ansible|
16+
ansible.limit = "all"
17+
ansible.playbook = "tests/vagrant/provision.yml"
18+
ansible.verbose = true
19+
end
20+
end
21+
end
22+
end
23+
end

defaults/main.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pve_zfs_enabled: no
1717
# pve_zfs_options: "parameters to pass to zfs module"
1818
# pve_zfs_zed_email: "email address for zfs events"
1919
pve_ceph_enabled: false
20-
pve_ceph_repository_line: "{{ pve_ceph_repo }}"
20+
pve_ceph_repository_line: "deb http://download.proxmox.com/debian/{% if ansible_distribution_release == 'stretch' %}ceph-luminous stretch{% else %}ceph-nautilus buster{% endif %} main"
2121
pve_ceph_network: "{{ (ansible_default_ipv4.network +'/'+ ansible_default_ipv4.netmask) | ipaddr('net') }}"
2222
pve_ceph_mon_group: "{{ pve_group }}"
2323
pve_ceph_mds_group: "{{ pve_group }}"
@@ -29,18 +29,12 @@ pve_ceph_crush_rules: []
2929
# pve_ssl_certificate: "contents of certificate"
3030
pve_cluster_enabled: no
3131
pve_cluster_clustername: "{{ pve_group }}"
32-
# PVE 5.x (Debian Stretch) clustering options
33-
pve_cluster_ring0_addr: "{{ ansible_default_ipv4.address }}"
34-
pve_cluster_bindnet0_addr: "{{ pve_cluster_ring0_addr }}"
35-
# pve_cluster_ring1_addr: "another interface's IP address or hostname"
36-
# pve_cluster_bindnet1_addr: "{{ pve_cluster_ring1_addr }}"
37-
# PVE 6.x (Debian Buster) clustering options
38-
pve_cluster_link0_addr: "{{ ansible_default_ipv4.address }}"
39-
# pve_cluster_link1_addr: "another interface's IP address or hostname"
32+
# pve_cluster_addr0: "{{ ansible_default_ipv4.address }}"
33+
# pve_cluster_addr1: "{{ ansible_eth1.ipv4.address }}
4034
pve_datacenter_cfg: {}
4135
pve_ssl_letsencrypt: false
4236
pve_groups: []
4337
pve_users: []
4438
pve_acls: []
4539
pve_storages: []
46-
pve_ssh_port: 22
40+
pve_ssh_port: 22

library/collect_kernel_info.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import subprocess
55

66
from ansible.module_utils.basic import AnsibleModule
7+
from ansible.module_utils._text import to_text
78

89
def main():
910
module = AnsibleModule(
@@ -51,17 +52,17 @@ def main():
5152

5253
# This will likely output a path that considers the boot partition as /
5354
# e.g. /vmlinuz-4.4.44-1-pve
54-
booted_kernel = subprocess.check_output(["grep", "-o", "-P", "(?<=BOOT_IMAGE=).*?(?= )", "/proc/cmdline"]).strip()
55+
booted_kernel = to_text(subprocess.check_output(["grep", "-o", "-P", "(?<=BOOT_IMAGE=).*?(?= )", "/proc/cmdline"]).strip())
5556

5657
booted_kernel_package = ""
5758
old_kernel_packages = []
5859

5960
if params['lookup_packages']:
6061
for kernel in kernels:
6162
if kernel.split("/")[-1] == booted_kernel.split("/")[-1]:
62-
booted_kernel_package = subprocess.check_output(["dpkg-query", "-S", kernel]).split(":")[0]
63+
booted_kernel_package = to_text(subprocess.check_output(["dpkg-query", "-S", kernel])).split(":")[0]
6364
elif kernel != latest_kernel:
64-
old_kernel_packages.append(subprocess.check_output(["dpkg-query", "-S", kernel]).split(":")[0])
65+
old_kernel_packages.append(to_text(subprocess.check_output(["dpkg-query", "-S", kernel])).split(":")[0])
6566

6667
# returns True if we're not booted into the latest kernel
6768
new_kernel_exists = booted_kernel.split("/")[-1] != latest_kernel.split("/")[-1]

module_utils/pvesh.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import json
55
import re
66

7+
from ansible.module_utils._text import to_text
8+
79
class ProxmoxShellError(Exception):
810
"""Exception raised when an unexpected response code is thrown from pvesh."""
911
def __init__(self, response):
@@ -23,12 +25,13 @@ def run_command(handler, resource, **params):
2325
handler,
2426
resource,
2527
"--output=json"]
26-
for parameter, value in params.iteritems():
28+
for parameter, value in params.items():
2729
command += ["-{}".format(parameter), "{}".format(value)]
2830

2931
pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
3032
(result, stderr) = pipe.communicate()
31-
stderr = stderr.splitlines()
33+
result = to_text(result)
34+
stderr = to_text(stderr).splitlines()
3235

3336
if len(stderr) == 0:
3437
if not result:

0 commit comments

Comments
 (0)