Browse Source

Add molecule test structure to ceph roles

Add molecule test structure for each ceph role. Also
add missing doc/*tripleo-ceph-*.rst files.

Local test setup changes have been made in support of
these roles.

Change-Id: I43b828d5c892a0b33c7a3cbae4034267ce493dc0
Task: 34717
Task: 34718
Task: 34719
Task: 34720
Story: 2006041
Signed-off-by: Kevin Carter <kecarter@redhat.com>
changes/94/668294/17
John Fulton 3 years ago committed by Kevin Carter
parent
commit
d762e27dc7
  1. 1
      ansible-test-env.rc
  2. 10
      doc/source/roles/role-tripleo-ceph-run-ansible.rst
  3. 10
      doc/source/roles/role-tripleo-ceph-uuid.rst
  4. 14
      scripts/run-local-test
  5. 29
      tripleo_ansible/roles/test_deps/tasks/main.yml
  6. 2
      tripleo_ansible/roles/tripleo-ceph-common/defaults/main.yml
  7. 37
      tripleo_ansible/roles/tripleo-ceph-common/molecule/default/Dockerfile
  8. 53
      tripleo_ansible/roles/tripleo-ceph-common/molecule/default/molecule.yml
  9. 21
      tripleo_ansible/roles/tripleo-ceph-common/molecule/default/playbook.yml
  10. 21
      tripleo_ansible/roles/tripleo-ceph-common/molecule/default/prepare.yml
  11. 45
      tripleo_ansible/roles/tripleo-ceph-common/tasks/main.yml
  12. 37
      tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/Dockerfile
  13. 53
      tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/molecule.yml
  14. 21
      tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/playbook.yml
  15. 21
      tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/prepare.yml
  16. 15
      tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/verify.yml
  17. 37
      tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/Dockerfile
  18. 53
      tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/molecule.yml
  19. 21
      tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/playbook.yml
  20. 21
      tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/prepare.yml
  21. 15
      tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/verify.yml
  22. 3
      tripleo_ansible/roles/tripleo-ceph-run-ansible/tasks/main.yml
  23. 37
      tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/Dockerfile
  24. 53
      tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/molecule.yml
  25. 21
      tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/playbook.yml
  26. 21
      tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/prepare.yml
  27. 15
      tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/verify.yml
  28. 2
      tripleo_ansible/roles/tripleo-ceph-uuid/tasks/gather.yml
  29. 37
      tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/Dockerfile
  30. 53
      tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/molecule.yml
  31. 21
      tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/playbook.yml
  32. 21
      tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/prepare.yml
  33. 15
      tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/verify.yml
  34. 3
      tripleo_ansible/roles/tripleo-ceph-work-dir/tasks/prepare.yml
  35. 10
      zuul.d/molecule.yaml
  36. 1
      zuul.d/playbooks/run.yml

1
ansible-test-env.rc

@ -9,6 +9,7 @@ export ANSIBLE_ROLES_PATH="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/roles.gal
export ANSIBLE_INVENTORY="${TRIPLEO_ANSIBLE_WORKPATH}/tests/hosts.ini"
export ANSIBLE_RETRY_FILES_ENABLED="0"
export ANSIBLE_LOAD_CALLBACK_PLUGINS="1"
export ANSIBLE_HOST_KEY_CHECKING=False
function unset-ansible-test-env {
for i in $(env | grep ANSIBLE_ | awk -F'=' '{print $1}'); do

10
doc/source/roles/role-tripleo-ceph-run-ansible.rst

@ -4,3 +4,13 @@ Role - tripleo-ceph-run-ansible
.. ansibleautoplugin::
:role: tripleo_ansible/roles/tripleo-ceph-run-ansible
Required test arguments
~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------+-------------------------------------------------+
| Environment Variable | Variable Value |
+==========================+=================================================+
| TRIPLEO_JOB_ANSIBLE_ARGS | '--skip-tags=run_uuid_ansible,run_ceph_ansible' |
+--------------------------+-------------------------------------------------+

10
doc/source/roles/role-tripleo-ceph-uuid.rst

@ -4,3 +4,13 @@ Role - tripleo-ceph-uuid
.. ansibleautoplugin::
:role: tripleo_ansible/roles/tripleo-ceph-uuid
Required test arguments
~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------+-------------------------------------------------+
| Environment Variable | Variable Value |
+==========================+=================================================+
| TRIPLEO_JOB_ANSIBLE_ARGS | '--skip-tags=run_uuid_ansible' |
+--------------------------+-------------------------------------------------+

14
scripts/run-local-test

@ -24,6 +24,7 @@ set -xeuo
export PROJECT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../"
export ROLE_NAME="${ROLE_NAME:-$1}"
export TRIPLEO_JOB_ANSIBLE_ARGS=${TRIPLEO_JOB_ANSIBLE_ARGS:-"-v"}
## Main ----------------------------------------------------------------------
@ -42,22 +43,27 @@ esac
# Create a virtual env
"${PYTHON_EXEC}" -m virtualenv --system-site-packages "${HOME}/test-python"
# Run bindep
"${HOME}/test-python/bin/pip" install pip setuptools bindep --upgrade
"${PROJECT_DIR}/scripts/bindep-install"
# Install local requirements
if [[ -d "${HOME}/.cache/pip/wheels" ]]; then
rm -rf "${HOME}/.cache/pip/wheels"
fi
"${HOME}/test-python/bin/pip" install \
-r "${PROJECT_DIR}/requirements.txt" \
-r "${PROJECT_DIR}/test-requirements.txt" \
-r "${PROJECT_DIR}/molecule-requirements.txt"
# Run bindep
PS1="[\u@\h \W]\$" source "${HOME}/test-python/bin/activate"
"${PROJECT_DIR}/scripts/bindep-install"
# Run local test
PS1="[\u@\h \W]\$" source "${HOME}/test-python/bin/activate"
source "${PROJECT_DIR}/ansible-test-env.rc"
export ANSIBLE_ROLES_PATH="${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
ansible-playbook -i "${PROJECT_DIR}/tests/hosts.ini" \
-e "tripleo_src=$(realpath --relative-to="${HOME}" "${PROJECT_DIR}")" \
-e "tripleo_role_name=${ROLE_NAME}" \
-e "tripleo_job_ansible_args='${TRIPLEO_JOB_ANSIBLE_ARGS}'" \
-e "ansible_user=${USER}" \
-e "ansible_user_dir=${HOME}" \
"${PROJECT_DIR}/tripleo_ansible/playbooks/prepare-test-host.yml" \

29
tripleo_ansible/roles/test_deps/tasks/main.yml vendored

@ -31,18 +31,25 @@
tags:
- always
- name: install deplorean repo
- name: RHEL Block
become: true
get_url:
url: "https://trunk.rdoproject.org/{{ ansible_distribution | lower }}{{ ansible_distribution_major_version }}-master/current-tripleo/delorean.repo"
dest: /etc/yum.repos.d/delorean.repo
when:
- (ansible_os_family | lower) == 'redhat'
block:
- name: install deplorean repo
become: true
get_url:
url: "https://trunk.rdoproject.org/{{ ansible_distribution | lower }}{{ ansible_distribution_major_version }}-master/current-tripleo/delorean.repo"
dest: /etc/yum.repos.d/delorean.repo
when:
- (ansible_os_family | lower) == 'redhat'
- name: install deplorean-deps repo
become: true
get_url:
url: "https://trunk.rdoproject.org/{{ ansible_distribution | lower }}{{ ansible_distribution_major_version }}-master/delorean-deps.repo"
dest: /etc/yum.repos.d/delorean-deps.repo
when:
- (ansible_os_family | lower) == 'redhat'
- name: install deplorean-deps repo
get_url:
url: "https://trunk.rdoproject.org/{{ ansible_distribution | lower }}{{ ansible_distribution_major_version }}-master/delorean-deps.repo"
dest: /etc/yum.repos.d/delorean-deps.repo
- name: Install selinux python libs
package:
name: libselinux-python
state: present

2
tripleo_ansible/roles/tripleo-ceph-common/defaults/main.yml

@ -126,7 +126,7 @@ blacklisted_hostnames: []
ceph_ansible_extra_vars:
ireallymeanit: 'yes'
container_binary: 'podman'
uuid_content: ''
uuid_content: {}
ceph_ansible_playbook_verbosity: 3
ceph_ansible_playbooks_param: ['default']
local_ceph_ansible_fetch_directory_backup: "{{ playbook_dir }}/ceph-ansible/fetch_backup"

37
tripleo_ansible/roles/tripleo-ceph-common/molecule/default/Dockerfile

@ -0,0 +1,37 @@
# Molecule managed
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

53
tripleo_ansible/roles/tripleo-ceph-common/molecule/default/molecule.yml

@ -0,0 +1,53 @@
---
driver:
name: docker
log: true
platforms:
- name: centos7
hostname: centos7
image: centos:7
dockerfile: Dockerfile
pkg_extras: python-setuptools
easy_install:
- pip
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
- name: fedora28
hostname: fedora28
image: fedora:28
dockerfile: Dockerfile
pkg_extras: python*-setuptools
environment:
<<: *env
provisioner:
name: ansible
inventory:
hosts:
all:
vars:
ansible_user: root
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
lint:
enabled: false
verifier:
name: testinfra
lint:
name: flake8

21
tripleo_ansible/roles/tripleo-ceph-common/molecule/default/playbook.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Converge
hosts: all
roles:
- role: "tripleo-ceph-common"

21
tripleo_ansible/roles/tripleo-ceph-common/molecule/default/prepare.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps

45
tripleo_ansible/roles/tripleo-ceph-common/tasks/main.yml

@ -0,0 +1,45 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# "tripleo-ceph-common" will search for and load any operating system variable file
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- name: set basic user fact
set_fact:
ansible_user: "{{ lookup('env', 'USER') }}"
when:
- ansible_user is undefined
- name: set basic home fact
set_fact:
ansible_user_dir: "{{ lookup('env', 'HOME') }}"
when:
- ansible_user_dir is undefined

37
tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/Dockerfile

@ -0,0 +1,37 @@
# Molecule managed
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

53
tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/molecule.yml

@ -0,0 +1,53 @@
---
driver:
name: docker
log: true
platforms:
- name: centos7
hostname: centos7
image: centos:7
dockerfile: Dockerfile
pkg_extras: python-setuptools
easy_install:
- pip
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
- name: fedora28
hostname: fedora28
image: fedora:28
dockerfile: Dockerfile
pkg_extras: python*-setuptools
environment:
<<: *env
provisioner:
name: ansible
inventory:
hosts:
all:
vars:
ansible_user: root
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
lint:
enabled: false
verifier:
name: testinfra
lint:
name: flake8

21
tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/playbook.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Converge
hosts: all
roles:
- role: "tripleo-ceph-fetch-dir"

21
tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/prepare.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps

15
tripleo_ansible/roles/tripleo-ceph-fetch-dir/molecule/default/verify.yml

@ -0,0 +1,15 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

37
tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/Dockerfile

@ -0,0 +1,37 @@
# Molecule managed
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

53
tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/molecule.yml

@ -0,0 +1,53 @@
---
driver:
name: docker
log: true
platforms:
- name: centos7
hostname: centos7
image: centos:7
dockerfile: Dockerfile
pkg_extras: python-setuptools
easy_install:
- pip
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
- name: fedora28
hostname: fedora28
image: fedora:28
dockerfile: Dockerfile
pkg_extras: python*-setuptools
environment:
<<: *env
provisioner:
name: ansible
inventory:
hosts:
all:
vars:
ansible_user: root
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
lint:
enabled: false
verifier:
name: testinfra
lint:
name: flake8

21
tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/playbook.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Converge
hosts: all
roles:
- role: "tripleo-ceph-run-ansible"

21
tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/prepare.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps

15
tripleo_ansible/roles/tripleo-ceph-run-ansible/molecule/default/verify.yml

@ -0,0 +1,15 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

3
tripleo_ansible/roles/tripleo-ceph-run-ansible/tasks/main.yml

@ -76,4 +76,5 @@
when:
- outputs is changed
- outputs.rc != 0
tags: run_ceph_ansible
tags:
- run_ceph_ansible

37
tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/Dockerfile

@ -0,0 +1,37 @@
# Molecule managed
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

53
tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/molecule.yml

@ -0,0 +1,53 @@
---
driver:
name: docker
log: true
platforms:
- name: centos7
hostname: centos7
image: centos:7
dockerfile: Dockerfile
pkg_extras: python-setuptools
easy_install:
- pip
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
- name: fedora28
hostname: fedora28
image: fedora:28
dockerfile: Dockerfile
pkg_extras: python*-setuptools
environment:
<<: *env
provisioner:
name: ansible
inventory:
hosts:
all:
vars:
ansible_user: root
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
lint:
enabled: false
verifier:
name: testinfra
lint:
name: flake8

21
tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/playbook.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Converge
hosts: all
roles:
- role: "tripleo-ceph-uuid"

21
tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/prepare.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps

15
tripleo_ansible/roles/tripleo-ceph-uuid/molecule/default/verify.yml

@ -0,0 +1,15 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

2
tripleo_ansible/roles/tripleo-ceph-uuid/tasks/gather.yml

@ -33,3 +33,5 @@
# needs become to be able to read the ssh private key
become: true
shell: "{{ nodes_uuid_list|join(' ') }}"
tags:
- run_uuid_ansible

37
tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/Dockerfile

@ -0,0 +1,37 @@
# Molecule managed
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

53
tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/molecule.yml

@ -0,0 +1,53 @@
---
driver:
name: docker
log: true
platforms:
- name: centos7
hostname: centos7
image: centos:7
dockerfile: Dockerfile
pkg_extras: python-setuptools
easy_install:
- pip
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
- name: fedora28
hostname: fedora28
image: fedora:28
dockerfile: Dockerfile
pkg_extras: python*-setuptools
environment:
<<: *env
provisioner:
name: ansible
inventory:
hosts:
all:
vars:
ansible_user: root
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
lint:
enabled: false
verifier:
name: testinfra
lint:
name: flake8

21
tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/playbook.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Converge
hosts: all
roles:
- role: "tripleo-ceph-work-dir"

21
tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/prepare.yml

@ -0,0 +1,21 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps

15
tripleo_ansible/roles/tripleo-ceph-work-dir/molecule/default/verify.yml

@ -0,0 +1,15 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

3
tripleo_ansible/roles/tripleo-ceph-work-dir/tasks/prepare.yml

@ -34,6 +34,9 @@
src: "{{ inventory_file }}"
dest: "{{ playbook_dir }}/ceph-ansible/inventory.yml"
state: link
tags:
- run_uuid_ansible
- run_ceph_ansible
- name: generate ceph-ansible group vars all
copy:

10
zuul.d/molecule.yaml

@ -18,6 +18,7 @@
- tripleo-ansible-centos-7-molecule-tripleo-transfer
- tripleo-ansible-centos-7-molecule-tripleo-podman
- tripleo-ansible-centos-7-molecule-tripleo-persist
- tripleo-ansible-centos-7-molecule-tripleo-ceph-run-ansible
gate:
jobs:
- tripleo-ansible-centos-7-molecule-aide
@ -36,6 +37,7 @@
- tripleo-ansible-centos-7-molecule-tripleo-transfer
- tripleo-ansible-centos-7-molecule-tripleo-podman
- tripleo-ansible-centos-7-molecule-tripleo-persist
- tripleo-ansible-centos-7-molecule-tripleo-ceph-run-ansible
name: tripleo-ansible-molecule-jobs
- job:
files:
@ -154,3 +156,11 @@
parent: tripleo-ansible-centos-7-base
vars:
tripleo_role_name: tripleo-persist
- job:
files:
- ^tripleo_ansible/roles/tripleo-ceph-run-ansible/.*
name: tripleo-ansible-centos-7-molecule-tripleo-ceph-run-ansible
parent: tripleo-ansible-centos-7-base
vars:
tripleo_role_name: tripleo-ceph-run-ansible
tripleo_job_ansible_args: '-v --skip-tags=run_uuid_ansible,run_ceph_ansible'

1
zuul.d/playbooks/run.yml

@ -12,6 +12,7 @@
--html={{ ansible_user_dir }}/zuul-output/logs/reports.html \
--self-contained-html \
-s \
--ansible-args='{{ tripleo_job_ansible_args | default("-v") }}' \
{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/test_molecule.py
args:
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tripleo_ansible/roles/{{ tripleo_role_name }}"

Loading…
Cancel
Save