diff --git a/common-tasks/test-set-nodepool-vars.yml b/common-tasks/test-set-nodepool-vars.yml index fdccd002..f150a474 100644 --- a/common-tasks/test-set-nodepool-vars.yml +++ b/common-tasks/test-set-nodepool-vars.yml @@ -34,6 +34,12 @@ when: - ansible_os_family == 'Debian' +- name: install the epel repo rpm from a remote repo + yum: + name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" + state: "present" + when: ansible_pkg_mgr == 'yum' + - name: Set the files to copy into the container cache for OpenStack-CI instances set_fact: lxc_container_cache_files: @@ -46,3 +52,4 @@ uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive" when: - ansible_pkg_mgr == 'apt' + - nodepool.stat.exists | bool diff --git a/create-grant-db.yml b/create-grant-db.yml index ac940b2c..71b54590 100644 --- a/create-grant-db.yml +++ b/create-grant-db.yml @@ -16,7 +16,7 @@ mysql_db: login_user: "root" login_password: "secrete" - login_host: "localhost" + login_host: "127.0.0.1" name: "{{ db_name }}" state: "present" delegate_to: "{{ groups['galera_all'][0] }}" @@ -25,7 +25,7 @@ mysql_user: login_user: "root" login_password: "secrete" - login_host: "localhost" + login_host: "127.0.0.1" name: "{{ db_name }}" password: "{{ db_password }}" host: "{{ item }}" diff --git a/tests/tests-network-interfaces.cfg.j2 b/debian-network-interfaces.cfg.j2 similarity index 89% rename from tests/tests-network-interfaces.cfg.j2 rename to debian-network-interfaces.cfg.j2 index ed31fcff..b30136ff 100644 --- a/tests/tests-network-interfaces.cfg.j2 +++ b/debian-network-interfaces.cfg.j2 @@ -5,6 +5,6 @@ iface br-mgmt inet static bridge_fd 0 # Notice the bridge port is the vlan tagged interface bridge_ports none - address 10.100.101.1 + address 10.1.0.1 netmask 255.255.255.0 offload-sg off diff --git a/redhat-network-interfaces.cfg.j2 b/redhat-network-interfaces.cfg.j2 new file mode 100644 index 00000000..569702fb --- /dev/null +++ b/redhat-network-interfaces.cfg.j2 @@ -0,0 +1,8 @@ +DEVICE=br-mgmt +TYPE=Bridge +IPADDR=10.1.0.1 +NETMASK=255.255.255.0 +ONBOOT=yes +BOOTPROTO=none +NM_CONTROLLED=no +DELAY=0 diff --git a/test-prepare-host.yml b/test-prepare-host.yml index bbf8b402..7875eb46 100644 --- a/test-prepare-host.yml +++ b/test-prepare-host.yml @@ -22,6 +22,11 @@ shell: "{{ playbook_dir }}/iptables-clear.sh" - set_fact: lxc_container_ssh_key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}" + - name: Ensure roots new public ssh key is in authorized_keys + authorized_key: + user: root + key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}" + manage_dir: no roles: - role: "lxc_hosts" lxc_net_address: 10.100.100.1 @@ -35,32 +40,44 @@ tags: - networking-dir-create - - name: Copy network configuration + - name: Copy network configuration (Debian) template: src: "{{ network_conf_filename }}" dest: /etc/network/interfaces.d/test_interfaces.cfg - register: network_interfaces + register: network_interfaces_deb when: - network_conf_filename is defined + - ansible_pkg_mgr == 'apt' + + - name: Copy network configuration (RedHat) + template: + src: "{{ network_conf_filename }}" + dest: /etc/sysconfig/network-scripts/ifcfg-br-mgmt + register: network_interfaces_rhel + when: + - network_conf_filename is defined + - ansible_pkg_mgr == 'yum' - name: Ensure our interfaces.d configuration files are loaded automatically lineinfile: dest: /etc/network/interfaces line: "source /etc/network/interfaces.d/*.cfg" + when: + - ansible_pkg_mgr == 'apt' tags: - networking-interfaces-load - name: Shut down the network interfaces command: "ifdown {{ item }}" when: - - network_interfaces | changed + - (network_interfaces_rhel | changed) or (network_interfaces_deb | changed) - network_conf_filename is defined with_items: bridges - name: Start the network interfaces command: "ifup {{ item }}" when: - - network_interfaces | changed + - (network_interfaces_rhel | changed) or (network_interfaces_deb | changed) - network_conf_filename is defined with_items: bridges @@ -69,16 +86,6 @@ - name: Add iptables rules for lxc natting command: /usr/local/bin/lxc-system-manage iptables-create - #TODO (evrardjp) - cleanup to latest standard: - - name: Install pip packages - command: /usr/local/bin/pip install {{ item }} - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: - - lxc-python2 - - name: Add iptables rules for lxc natting command: /usr/local/bin/lxc-system-manage iptables-create diff --git a/test-vars.yml b/test-vars.yml index e39bdf95..e8bd2d03 100644 --- a/test-vars.yml +++ b/test-vars.yml @@ -224,3 +224,6 @@ tempest_service_available_swift: False openrc_os_password: "{{ keystone_auth_admin_password }}" openrc_os_domain_name: "Default" openrc_os_auth_url: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}:5000/v3" + +# Network configuration settings +network_conf_filename: "{{ ansible_os_family | lower }}-network-interfaces.cfg.j2" diff --git a/tests/inventory b/tests/inventory index 8127e392..01506715 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,8 +1,8 @@ [all] localhost ansible_connection=local ansible_become=True -infra1 ansible_ssh_host=10.100.101.2 ansible_host=10.100.101.2 ansible_become=True ansible_user=root -keystone1 ansible_ssh_host=10.100.101.3 ansible_host=10.100.101.3 ansible_become=True ansible_user=root -keystone2 ansible_ssh_host=10.100.101.4 ansible_host=10.100.101.4 ansible_become=True ansible_user=root +infra1 ansible_ssh_host=10.1.0.2 ansible_host=10.1.0.2 ansible_become=True ansible_user=root +keystone1 ansible_ssh_host=10.1.0.3 ansible_host=10.1.0.3 ansible_become=True ansible_user=root +keystone2 ansible_ssh_host=10.1.0.4 ansible_host=10.1.0.4 ansible_become=True ansible_user=root [all_containers] infra1 diff --git a/tox.ini b/tox.ini index 80462649..c4b412a0 100644 --- a/tox.ini +++ b/tox.ini @@ -163,7 +163,6 @@ setenv = commands = {[testenv:ansible]commands} ansible-playbook -i {toxinidir}/tests/inventory \ - -e "network_conf_filename=tests/tests-network-interfaces.cfg.j2" \ {toxinidir}/tests/test.yml -vvvv