12 Commits

Author SHA1 Message Date
Sagi Shnaidman
07374a1f0d Add mandatory requires_ansible version to metadata
Disable ansible-test since it's broken in 2.11[1]

[1] https://github.com/ansible/ansible/issues/75353
Change-Id: Idd2f99ddfe507b5b02de206c1f8c75692d6a84a2
2021-07-29 17:05:11 +03:00
Sagi Shnaidman
8a395a04cf Remove semver check from release job
Jinja in Zuul Ansible version doesn't support semver key for versions.
Change-Id: I8bf9aa17e18f9b6d2c8e307f4368d1cea3362cb5
2021-07-29 10:20:32 +03:00
Zuul
441a61fd8c Merge "Change the pipeline of releasing to tag pipeline" 2021-07-28 23:14:40 +00:00
Sagi Shnaidman
c05b1fdbaf Change the pipeline of releasing to tag pipeline
Because zuul pre-release pipeline is pep400 compliant, but no
semver compliant, we can't push pre-release tags. Galaxy expects
from tags to be pure semver (not pep440).
Change the pipeline to be 'tag' and be triggered by any tag.

Change-Id: Ia288452668179723e35452d6e9579fb1dd0c4c3a
2021-07-28 23:43:51 +03:00
Zuul
9cd92208d6 Merge "Wait for pool to be active and online" 2021-07-28 16:55:56 +00:00
Sagi Shnaidman
5ef192f1f2 Add automatic release job triggered by tag
Currently put it in pre-release pipeline to test that it's ok.

Change-Id: I791478464ed59933273bb0e5f88f3636074c6729
2021-07-28 15:11:07 +03:00
Jesper Schmitz Mouridsen
aed60716ee Wait for pool to be active and online
In order to use a newly generated pool for a new
healthmonitor the pool must be online and active,
to avoid 409 conflict, when trying to update a pool
with e.g pending update as a status.

Change-Id: I160a75c6fbbf1555f3adcb444c77057f59b4cdfb
2021-07-19 13:05:33 +02:00
cuongmax
938b90ea19 Add protocol listener octavia
Signed-off-by: cuongmax <ptitcuongmax@gmail.com>
Change-Id: I98c316865837e7c68fa3eed2f5304950ebfc2141
2021-07-17 09:17:55 +07:00
Zuul
ce853a8f9f Merge "Add missing info to changelog" 2021-06-24 20:42:05 +00:00
Sagi Shnaidman
9911c7f93a Add missing info to changelog
Change-Id: Ic6113a785090cc05771fb2f4730dc25f40a8d4dc
2021-06-24 23:13:24 +03:00
Sagi Shnaidman
8c890e656b Update IRC server in README
Change-Id: Ida13b691ae09c2222ae1c83a88b47702fdf684f4
2021-06-24 16:59:56 +03:00
Sagi Shnaidman
b839f9e25d Bump to devel 1.5.1-dev version
Change-Id: I99857903ed22f46e4bbf317dab49f5e581141ea2
2021-06-23 18:41:14 +03:00
10 changed files with 155 additions and 7 deletions

View File

@@ -276,7 +276,7 @@
nodeset: ubuntu-bionic
description: |
Run openstack collections linter tests using the 2.11 branch of ansible
voting: true
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
@@ -336,6 +336,29 @@
vars:
branch_override: stable/train
- job:
name: ansible-collections-openstack-release
parent: base
run: ci/publish/publish_collection.yml
secrets:
- ansible_galaxy_info
- secret:
name: ansible_galaxy_info
data:
url: https://galaxy.ansible.com
token: !encrypted/pkcs1-oaep
- lZFzfoCbuwqV1k6qRfl/VS7E+knUW7+zpg7BptrenK4n0g7UY0HtdVkYq0pV0Tj/LbhzG
jHD0mehcV1iS6B7ORKg4criJkdDfEx09BD8z8yv0EleiIMmhlrCoMcY593OZMBtVbGi0D
CwQtNO98QIsfZogChfLfvRNiBmUV98mEb/p6p3EtGx8J7qcAsqfWxc/CzB8GCleLAHHHT
FuikMM03ZnV0ew7E+TPkHbzzPhBZOqS5HYF0HtgttHwIXdfIWp/XdTuEEk7uRRgYZ2Iao
ifWRzoKaOQmhM++e1ydCqw9D4y9dZEFNMQLwSqcrvtb8cNwT1kl7SCFqYNE2lbutj4ne6
PTBQRsKegMB4Y3ena14fNF6tCynvJLPhF/cjPH2Jhs+B19XQhWkL3TgiOY02W24YHwRcP
+LdkM8inAvyVi3DEbEqdjBPO9OFJcBOKPlCdkGvuwdNCuEpEwctWs0gV3voflG2CDKzmJ
wu9JJOAWnq/0l1WpuDqWreKeQ/BUGZC2Gb4xRAqofulgvhs4WuYoEccjH4EJFIZ90S1EP
R/ZLadqZaEhmjwGM5sMWbBbjT23XsRgg0Tzt9m8DENYMuYDqkMdRbt2jYZa+32p4hyxVe
Y6H/pqYq5b9uOzumnShaK4WlmkQyXcNPkoSlMC1h4OGvqX/WUixpI38jyMA5Tc=
- project:
check:
jobs:
@@ -347,7 +370,7 @@
dependencies: &deps_unit_lint
- tox-pep8
- openstack-tox-linters-ansible-2.9
- openstack-tox-linters-ansible-2.11
# - openstack-tox-linters-ansible-2.11
- ansible-collections-openstack-functional-devstack-releases:
dependencies: *deps_unit_lint
@@ -390,7 +413,7 @@
gate:
jobs:
- tox-pep8
- openstack-tox-linters-ansible-2.11
# - openstack-tox-linters-ansible-2.11
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack
- ansible-collections-openstack-functional-devstack-releases
@@ -429,3 +452,7 @@
- ansible-collections-openstack-functional-devstack-stein-ansible-2.11
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.11
- ansible-collections-openstack-functional-devstack-queens-ansible-devel
tag:
jobs:
- ansible-collections-openstack-release

View File

@@ -76,6 +76,7 @@ New Modules
- openstack.cloud.dns_zone_info - Getting information about dns zones
- openstack.cloud.floating_ip_info - Get information about floating ips
- openstack.cloud.address_scope - Create or delete address scopes from OpenStack
v1.4.0
======

View File

@@ -114,7 +114,7 @@ TBD
## Communication
We have a dedicated Interest Group for Openstack Ansible modules.
You can find other people interested in this in `#openstack-ansible-sig` on Freenode IRC.
You can find other people interested in this in `#openstack-ansible-sig` on [OFTC IRC](https://www.oftc.net/).
## License

View File

@@ -228,4 +228,7 @@ releases:
- description: Get information about floating ips
name: floating_ip_info
namespace: ''
- description: Create or delete address scopes from OpenStack
name: address_scope
namespace: ''
release_date: '2021-06-23'

View File

@@ -0,0 +1,75 @@
---
- hosts: all
vars:
collection_path: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/ansible-collections-openstack'].src_dir }}"
build_collection_path: /tmp/collection_built/
ansible_galaxy_path: "~/.local/bin/ansible-galaxy"
tasks:
- name: Include role for pip
include_role:
name: ensure-pip
- name: Install ansible
pip:
name: ansible-core<2.12
- name: Discover tag version
set_fact:
version_tag: "{{ zuul.tag|default('no_version', true) }}"
- name: Fail if no tag version found
fail:
msg: "No tag was found in Zuul vars!"
when: version_tag == 'no_version'
- name: Create a directory for collection
file:
state: "{{ item }}"
path: "{{ build_collection_path }}"
loop:
- absent
- directory
- name: Set galaxy.yml for right version from tag
lineinfile:
path: '{{ collection_path }}/galaxy.yml'
regexp: '^version:.*'
line: 'version: {{ version_tag }}'
- name: Build collection
command: "{{ ansible_galaxy_path }} collection build --output-path {{ build_collection_path }} --force"
args:
chdir: "{{ collection_path }}"
- name: Publish content to Ansible Galaxy
block:
- name: Create ansible.cfg configuration file tempfile
tempfile:
state: file
suffix: .cfg
register: _ansiblecfg_tmp
- name: Create ansible.cfg configuration file
copy:
dest: "{{ _ansiblecfg_tmp.path }}"
mode: 0600
content: |
[galaxy]
server_list = release_galaxy
[galaxy_server.release_galaxy]
url = {{ ansible_galaxy_info.url }}
token = {{ ansible_galaxy_info.token }}
- name: Publish collection to Ansible Galaxy / Automation Hub
environment:
ANSIBLE_CONFIG: "{{ _ansiblecfg_tmp.path }}"
shell: >-
{{ ansible_galaxy_path }} collection publish -vvv
{{ build_collection_path }}/openstack-cloud-{{ version_tag }}.tar.gz
always:
- name: Shred ansible-galaxy credentials
command: "shred {{ _ansiblecfg_tmp.path }}"

View File

@@ -33,4 +33,4 @@ build_ignore:
- ansible_collections_openstack.egg-info
- contrib
- changelogs
version: 1.5.0
version: 1.5.1-dev

View File

@@ -1,3 +1,4 @@
requires_ansible: ">=2.8"
action_groups:
openstack:
- address_scope

View File

@@ -30,7 +30,7 @@ options:
protocol:
description:
- The protocol for the listener.
choices: [HTTP, HTTPS, TCP, TERMINATED_HTTPS]
choices: [HTTP, HTTPS, TCP, TERMINATED_HTTPS, UDP, SCTP]
default: HTTP
type: str
protocol_port:
@@ -152,7 +152,7 @@ class LoadbalancerListenerModule(OpenStackModule):
state=dict(default='present', choices=['absent', 'present']),
loadbalancer=dict(required=True),
protocol=dict(default='HTTP',
choices=['HTTP', 'HTTPS', 'TCP', 'TERMINATED_HTTPS']),
choices=['HTTP', 'HTTPS', 'TCP', 'TERMINATED_HTTPS', 'UDP', 'SCTP']),
protocol_port=dict(default=80, type='int', required=False),
)
module_kwargs = dict()

View File

@@ -296,6 +296,35 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class LoadBalancerModule(OpenStackModule):
def _wait_for_pool(self, pool, provisioning_status, operating_status, failures, interval=5):
"""Wait for pool to be in a particular provisioning and operating status."""
timeout = self.params['timeout'] # reuse loadbalancer timeout
total_sleep = 0
if failures is None:
failures = []
while total_sleep < timeout:
pool = self.conn.load_balancer.find_pool(name_or_id=pool.id)
if pool:
if pool.provisioning_status == provisioning_status and pool.operating_status == operating_status:
return None
if pool.provisioning_status in failures:
self.fail_json(
msg="Pool %s transitioned to failure state %s" %
(pool.id, pool.provisioning_status)
)
else:
if provisioning_status == "DELETED":
return None
else:
self.fail_json(
msg="Pool %s transitioned to DELETED" % pool.id
)
time.sleep(interval)
total_sleep += interval
def _wait_for_lb(self, lb, status, failures, interval=5):
"""Wait for load balancer to be in a particular provisioning status."""
timeout = self.params['timeout']
@@ -497,6 +526,7 @@ class LoadBalancerModule(OpenStackModule):
protocol=protocol,
lb_algorithm=lb_algorithm
)
self._wait_for_pool(pool, "ACTIVE", "ONLINE", ["ERROR"])
changed = True
# Ensure members in the pool
@@ -538,6 +568,7 @@ class LoadBalancerModule(OpenStackModule):
protocol_port=protocol_port,
subnet_id=subnet_id
)
self._wait_for_pool(pool, "ACTIVE", "ONLINE", ["ERROR"])
changed = True
# Associate public ip to the load balancer VIP. If

10
tox.ini
View File

@@ -111,3 +111,13 @@ deps =
-r{toxinidir}/test-requirements-2.11.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:galaxy-release]
deps =
ansible-core
commands =
/usr/bin/mkdir -p /tmp/collection_built
/usr/bin/bash -ec 'rm -rf /tmp/collection_built/*'
/usr/bin/sed -i "s/version:.*/version: {env:VERSION_TAG}/" {toxinidir}/galaxy.yml
ansible-galaxy collection build {toxinidir} --output-path /tmp/collection_built/ --force
ansible-galaxy collection publish /tmp/collection_built/openstack-cloud-{env:VERSION_TAG}.tar.gz --token {env:API_GALAXY_TOKEN}