![Carlos Camacho](/assets/img/avatar_default.png)
This patch adds the first structure to run molecule and test this role It includes a basic escenario to run the tripleo-upgrade role without parameters. Change-Id: I5b569ef8dca549581c918ee6bbde1234c68aa5a6
71 lines
2.4 KiB
YAML
71 lines
2.4 KiB
YAML
---
|
|
|
|
- hosts: all
|
|
pre_tasks:
|
|
- name: Set project path fact
|
|
set_fact:
|
|
tripleo_upgrade_project_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
|
|
|
- name: Set action plugin path fact
|
|
set_fact:
|
|
tripleo_action_plugins_paths:
|
|
- "{{ tripleo_upgrade_project_path }}/molecule/roles.galaxy/config_template/action"
|
|
- "{{ tripleo_upgrade_project_path }}/molecule/ansible_plugins/action"
|
|
- "/usr/share/ansible/plugins/action"
|
|
- "/usr/share/ansible/tripleo-plugins/action"
|
|
|
|
- name: Ensure output dirs
|
|
file:
|
|
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
|
state: directory
|
|
|
|
- name: Setup bindep
|
|
pip:
|
|
name: "bindep"
|
|
virtualenv: "{{ ansible_user_dir }}/test-python"
|
|
virtualenv_site_packages: true
|
|
|
|
- name: Run bindep
|
|
shell: |-
|
|
. {{ ansible_user_dir }}/test-python/bin/activate
|
|
{{ tripleo_upgrade_project_path }}/molecule/scripts/bindep-install
|
|
become: true
|
|
|
|
- name: Setup test-python
|
|
pip:
|
|
requirements: "{{ tripleo_upgrade_project_path }}/molecule/molecule-requirements.txt"
|
|
virtualenv: "{{ ansible_user_dir }}/test-python"
|
|
virtualenv_site_packages: true
|
|
tasks:
|
|
- name: Get Ansible Galaxy roles
|
|
command: >-
|
|
{{ ansible_user_dir }}/test-python/bin/ansible-galaxy install
|
|
-fr
|
|
{{ tripleo_upgrade_project_path }}/molecule/ansible-role-requirements.yml
|
|
environment:
|
|
ANSIBLE_ROLES_PATH: "{{ tripleo_upgrade_project_path }}/molecule/roles.galaxy"
|
|
|
|
- name: List Ansible Galaxy installed roles
|
|
command: >-
|
|
{{ ansible_user_dir }}/test-python/bin/ansible-galaxy list
|
|
environment:
|
|
ANSIBLE_ROLES_PATH: "{{ tripleo_upgrade_project_path }}/molecule/roles.galaxy"
|
|
|
|
roles:
|
|
- role: install-docker
|
|
post_tasks:
|
|
- name: Run docker vfs setup
|
|
shell: |-
|
|
. {{ ansible_user_dir }}/test-python/bin/activate
|
|
. {{ tripleo_upgrade_project_path }}/molecule/ansible-test-env.rc
|
|
ansible-playbook -i 'localhost,' \
|
|
-e tripleo_docker_enable_vfs={{ tripleo_docker_enable_vfs }} \
|
|
docker-vfs-setup.yml
|
|
args:
|
|
chdir: "{{ tripleo_upgrade_project_path }}/playbooks"
|
|
executable: /bin/bash
|
|
environment:
|
|
ANSIBLE_ACTION_PLUGINS: "{{ tripleo_action_plugins_paths | join(':') }}"
|
|
when:
|
|
- tripleo_docker_enable_vfs is defined
|