-
Notifications
You must be signed in to change notification settings - Fork 1k
updata testbed playbook for ubuntu 17.04 #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| # - id: sequence number for vm set on the host. | ||
| # - external_iface: interface which will be used as parent for vlan interface creation | ||
| # - vlan_base: first vlan id for the VMs | ||
| # - VMs: a dictionary which contains hostnames of VMs as a key and a dictionary with parameters (num, memory, mgmt_ip) for every VM. | ||
| # - VMs: a dictionary which contains hostnames of VMs as a key and a dictionary with parameters (num, memory, mgmt_ip) for every VM. | ||
| # - topology: a dictionary which contains hostnames of VMs as a key and vlans value which define a topology (numbers of connected ports for every VM) | ||
| # - mgmt_bridge: linux bridge which is used for management interface connections | ||
| # - root_path: path where disk images for VMs are created | ||
|
|
@@ -13,8 +13,47 @@ | |
| # - vm_images_url: url where base images are located | ||
| # - vmimages_saskey: a key for Azure download service. Could be set to '' | ||
|
|
||
| - name: Check if kernel upgrade needed | ||
| set_fact: | ||
| kernel_upgrade_needed: true | ||
| when: | ||
| - ansible_distribution == "Ubuntu" | ||
| - ansible_distribution_version == "17.04" | ||
| - ansible_kernel.find('4.10.0') != -1 | ||
| - "{{ ansible_kernel | regex_replace('4.10.0-([0-9]+)-.*', '\\1') | int < 25 }}" | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to make this kernel upgrade? Can you please leave a comment?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added comments |
||
| - block: | ||
| - debug: msg="{{ ansible_kernel }}" | ||
|
|
||
| - name: Upgrade kernel package | ||
| apt: pkg={{ item }} state=latest | ||
| become: yes | ||
| with_items: | ||
| - linux-image-generic | ||
| - linux-image-extra-virtual | ||
|
|
||
| - name: Prompt for rebooting | ||
| fail: | ||
| msg: "Kernel upgraded, need to reboot!" | ||
| when: kernel_upgrade_needed is defined | ||
|
|
||
| - name: Add docker repository for 17.04 | ||
| apt_repository: | ||
| repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable | ||
| state: present | ||
| become: yes | ||
| when: ansible_distribution_version == "17.04" | ||
|
|
||
| - name: Add docker repository for 16.04 | ||
| apt_repository: | ||
| repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable | ||
| state: present | ||
| become: yes | ||
| when: ansible_distribution_version == "16.04" | ||
|
|
||
| - name: Install necessary packages | ||
| apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 | ||
| apt: pkg={{ item }} update_cache=yes cache_valid_time=86400 | ||
| become: yes | ||
| with_items: | ||
| - qemu | ||
| - openvswitch-switch | ||
|
|
@@ -26,11 +65,24 @@ | |
| - libvirt-bin | ||
| - python-libvirt | ||
| - python-pip | ||
| - apt-transport-https | ||
| - ca-certificates | ||
| - curl | ||
| - software-properties-common | ||
| - docker-ce | ||
|
|
||
| - name: Install python packages | ||
| pip: name=docker-py state=present version=1.7.2 | ||
| become: yes | ||
| environment: "{{ proxy_env | default({}) }}" | ||
|
|
||
| - name: Install br_netfilter kernel module | ||
| become: yes | ||
| modprobe: name=br_netfilter state=present | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need br_netfilter?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in roles/vm_set/test/start.yml ""
|
||
|
|
||
| - name: Ensure {{ root_path }} exists | ||
| file: path={{ root_path }} state=directory | ||
|
|
||
| - name: Install cleanup script | ||
| template: src=cleanup.sh.j2 | ||
| dest={{ root_path }}/cleanup.sh | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,4 +9,4 @@ | |
| vm_topology: | ||
| cmd: 'destroy' | ||
| vm_names: "{{ VM_hosts }}" | ||
|
|
||
| become: yes | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's too long to cache all facts to one day. What if some interface was up and now it's down?
We should be able to track such things from our playbook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are really using those data. the only data we need is the kernel version and distribution, I'll decrease it to 10 minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But ansible.cfg is global.
Our tests can use ansible facts extensively.