mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-03-27 05:53:02 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a395a04cf | ||
|
|
441a61fd8c | ||
|
|
c05b1fdbaf | ||
|
|
9cd92208d6 | ||
|
|
5ef192f1f2 | ||
|
|
aed60716ee | ||
|
|
938b90ea19 | ||
|
|
ce853a8f9f | ||
|
|
9911c7f93a | ||
|
|
8c890e656b | ||
|
|
b839f9e25d |
27
.zuul.yaml
27
.zuul.yaml
@@ -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:
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
======
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
75
ci/publish/publish_collection.yml
Normal file
75
ci/publish/publish_collection.yml
Normal 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 }}"
|
||||
@@ -33,4 +33,4 @@ build_ignore:
|
||||
- ansible_collections_openstack.egg-info
|
||||
- contrib
|
||||
- changelogs
|
||||
version: 1.5.0
|
||||
version: 1.5.1-dev
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
10
tox.ini
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user