Skip to content

Commit

Permalink
Run functional devstack job on ansible collection
Browse files Browse the repository at this point in the history
Porting of job that was running on patches in Ansible.

Change-Id: Ifa5a6b40d6a0f1de9f2cbc917a55c2d0e8ac421d
  • Loading branch information
sshnaidm committed Jan 20, 2020
1 parent 57b7683 commit 7c52b83
Show file tree
Hide file tree
Showing 36 changed files with 1,050 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ci/playbooks/devstack/post.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- hosts: all
roles:
- fetch-tox-output
6 changes: 6 additions & 0 deletions ci/roles/auth/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Authenticate to the cloud
openstack.cloud.os_auth:
cloud={{ cloud }}

- debug: var=service_catalog
7 changes: 7 additions & 0 deletions ci/roles/client_config/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: List all profiles
openstack.cloud.os_client_config:
register: list

# WARNING: This will output sensitive authentication information!!!!
- debug: var=list
1 change: 1 addition & 0 deletions ci/roles/group/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
group_name: ansible_group
19 changes: 19 additions & 0 deletions ci/roles/group/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Create group
openstack.cloud.os_group:
cloud: "{{ cloud }}"
state: present
name: "{{ group_name }}"

- name: Update group
openstack.cloud.os_group:
cloud: "{{ cloud }}"
state: present
name: "{{ group_name }}"
description: "updated description"

- name: Delete group
openstack.cloud.os_group:
cloud: "{{ cloud }}"
state: absent
name: "{{ group_name }}"
1 change: 1 addition & 0 deletions ci/roles/image/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image_name: ansible_image
54 changes: 54 additions & 0 deletions ci/roles/image/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
- name: Create a test image file
shell: mktemp
register: tmp_file

- name: Fill test image file to 1MB
shell: truncate -s 1048576 {{ tmp_file.stdout }}

- name: Create raw image (defaults)
openstack.cloud.os_image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.stdout }}"
disk_format: raw
register: image

- debug: var=image

- name: Delete raw image (defaults)
openstack.cloud.os_image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"

- name: Create raw image (complex)
openstack.cloud.os_image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.stdout }}"
disk_format: raw
is_public: True
min_disk: 10
min_ram: 1024
kernel: cirros-vmlinuz
ramdisk: cirros-initrd
properties:
cpu_arch: x86_64
distro: ubuntu
register: image

- debug: var=image

- name: Delete raw image (complex)
openstack.cloud.os_image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"

- name: Delete test image file
file:
name: "{{ tmp_file.stdout }}"
state: absent
1 change: 1 addition & 0 deletions ci/roles/keypair/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
keypair_name: shade_keypair
62 changes: 62 additions & 0 deletions ci/roles/keypair/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
- name: Create keypair (non-existing)
openstack.cloud.os_keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
register:
keypair

# This assert verifies that Ansible is capable serializing data returned by SDK
- name: Ensure private key is returned
assert:
that:
- keypair.key.public_key is defined and keypair.key.public_key

- name: Delete keypair (non-existing)
openstack.cloud.os_keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent

- name: Generate test key file
user:
name: "{{ ansible_env.USER }}"
generate_ssh_key: yes
ssh_key_file: .ssh/shade_id_rsa

- name: Create keypair (file)
openstack.cloud.os_keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
public_key_file: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa.pub"

- name: Delete keypair (file)
openstack.cloud.os_keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent

- name: Create keypair (key)
openstack.cloud.os_keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
public_key: "{{ lookup('file', '~/.ssh/shade_id_rsa.pub') }}"

- name: Delete keypair (key)
openstack.cloud.os_keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent

- name: Delete test key pub file
file:
name: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa.pub"
state: absent

- name: Delete test key pvt file
file:
name: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa"
state: absent
1 change: 1 addition & 0 deletions ci/roles/keystone_domain/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
domain_name: ansible_domain
19 changes: 19 additions & 0 deletions ci/roles/keystone_domain/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Create keystone domain
openstack.cloud.os_keystone_domain:
cloud: "{{ cloud }}"
state: present
name: "{{ domain_name }}"
description: "test description"

- name: Update keystone domain
openstack.cloud.os_keystone_domain:
cloud: "{{ cloud }}"
name: "{{ domain_name }}"
description: "updated description"

- name: Delete keystone domain
openstack.cloud.os_keystone_domain:
cloud: "{{ cloud }}"
state: absent
name: "{{ domain_name }}"
1 change: 1 addition & 0 deletions ci/roles/keystone_role/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
role_name: ansible_keystone_role
12 changes: 12 additions & 0 deletions ci/roles/keystone_role/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Create keystone role
openstack.cloud.os_keystone_role:
cloud: "{{ cloud }}"
state: present
name: "{{ role_name }}"

- name: Delete keystone role
openstack.cloud.os_keystone_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"
3 changes: 3 additions & 0 deletions ci/roles/network/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
network_name: shade_network
network_shared: false
network_external: false
14 changes: 14 additions & 0 deletions ci/roles/network/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Create network
openstack.cloud.os_network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"

- name: Delete network
openstack.cloud.os_network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: absent
53 changes: 53 additions & 0 deletions ci/roles/nova_flavor/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
- name: Create public flavor
openstack.cloud.os_nova_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_public_flavor
is_public: True
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
flavorid: 12345

- name: Delete public flavor
openstack.cloud.os_nova_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_public_flavor

- name: Create private flavor
openstack.cloud.os_nova_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_private_flavor
is_public: False
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
flavorid: 12345

- name: Delete private flavor
openstack.cloud.os_nova_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_private_flavor

- name: Create flavor (defaults)
openstack.cloud.os_nova_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_defaults_flavor
ram: 1024
vcpus: 1
disk: 10

- name: Delete flavor (defaults)
openstack.cloud.os_nova_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_defaults_flavor
37 changes: 37 additions & 0 deletions ci/roles/object/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- name: Create a test object file
shell: mktemp
register: tmp_file

- name: Create container
openstack.cloud.os_object:
cloud: "{{ cloud }}"
state: present
container: ansible_container
container_access: private

- name: Put object
openstack.cloud.os_object:
cloud: "{{ cloud }}"
state: present
name: ansible_object
filename: "{{ tmp_file.stdout }}"
container: ansible_container

- name: Delete object
openstack.cloud.os_object:
cloud: "{{ cloud }}"
state: absent
name: ansible_object
container: ansible_container

- name: Delete container
openstack.cloud.os_object:
cloud: "{{ cloud }}"
state: absent
container: ansible_container

- name: Delete test object file
file:
name: "{{ tmp_file.stdout }}"
state: absent
6 changes: 6 additions & 0 deletions ci/roles/port/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
network_name: ansible_port_network
network_external: true
subnet_name: ansible_port_subnet
port_name: ansible_port
secgroup_name: ansible_port_secgroup
no_security_groups: True
Loading

0 comments on commit 7c52b83

Please sign in to comment.