Skip to content

Commit

Permalink
install pbench agent on trafficgen host
Browse files Browse the repository at this point in the history
  • Loading branch information
asyedham committed Jan 22, 2021
1 parent 64c5ce8 commit 674f501
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 78 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,28 @@ Note: User can customize [internal.yml.j2](templates/internal.yml.j2) template f
## Pbench agent Installations
To install Pbench agent on the compute nodes and vm's (i.e client and server),you have to follow the below steps and set the below params install/group_vars/all.yml

`pbench_key_url: <pbench_key_url>
```
pbench_key_url: <pbench_key_url>
pbench_config_url: <pbench_config_url>
pbench_configuration_environment: <pbench_configuration_environment>`
#check the infrared inv to update the value
id_rsa_overcloud: ~/.infrared/.workspaces/<update_value>/id_rsa_overcloud
undercloud_hostname: <undercloud hostname>
```

`cd {{ ansible_user_dir}}/jetpack/install`

1) To create the client and server
`ansible-playbook boot.yml`
`ansible-playbook boot_vms.yml`

To install Pbench agent on Trafficgen host, set the below params

```
trafficgen_host:
ip: <ip>
ssh_pass: password
ssh_user: root
```
2) Install Pbench agent bootstrapping
`ansible-playbook pbench_agent_bootstrap.yml -e "repos=<perf-dept-repo>" `
3) Install Pbench agent install
Expand Down
8 changes: 0 additions & 8 deletions install/boot_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@
with_items:
- "{{ vm_names }}"

- name: get computes ip
shell: |
. {{ stackrc }}
nova list | grep {{ item }} | cut -d \| -f 7 |cut -d \= -f 2 | awk '{$1=$1;print}'
register: computes_ip
with_items:
- "{{ compute_names }}"

- name: update user to root
lineinfile:
path: "{{ user_dir}}/.ssh/config"
Expand Down
19 changes: 13 additions & 6 deletions install/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,26 @@ epel_repo:

pbench_image_rhel: false

compute_names: ['compute-0', 'compute-1' ]

#name for the client and server
vm_names: [ client, server ]
# port names
ports: [ 'client_port', 'server_port']
timeout: 15

# trafficgen host ip address
#trafficgen_host:
# ip: <ip>
# ssh_pass: password
# ssh_user: root

user_dir: /home/stack
overcloudrc: /home/stack/overcloudrc
stackrc: /home/stack/stackrc
# port names
ports: [ 'client_port', 'server_port']
timeout: 30

# update the values to install pbench agent
#check the infrared inv
#id_rsa_overcloud: ~/.infrared/.workspaces/<update_value>/id_rsa_overcloud
#undercloud_hostname:
#pbench_key_url:
#pbench_config_url:
#pbench_configuration_environment: "production"
pbench_configuration_environment: "production"
12 changes: 9 additions & 3 deletions install/pbench_agent_bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@
GIT_SSL_NO_VERIFY=true git clone {{ repos }}
ignore_errors: yes

- name: copy keys to trafficgen host
shell: |
echo '{{ trafficgen_host.ssh_pass }}' | sshpass ssh-copy-id -i ~/.ssh/id_rsa -o 'StrictHostKeyChecking no' -f {{ trafficgen_host.ssh_user }}@{{ trafficgen_host.ip }}
register: ssh_result
changed_when: false
ignore_errors: true
when: trafficgen_host is defined

- name: get computes ip
shell: |
. {{ stackrc }}
nova list | grep {{ item }} | cut -d \| -f 7 |cut -d \= -f 2 | awk '{$1=$1;print}'
nova list | grep -i "compute" | cut -d \| -f 7 |cut -d \= -f 2 | awk '{$1=$1;print}'
register: computes_ip
with_items:
- "{{ compute_names }}"

- name: get floating ip of server and client
shell: |
Expand Down
96 changes: 49 additions & 47 deletions install/pbench_agent_install.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
---
#
# Playbook for pbench agent installations
# Usage:
# ansible-playbook pbench_agent_install.yml

- hosts: compute
gather_facts: yes
tasks:
- name: install latest epel-release
- name: install latest epel and perl-Data-UUID
yum:
name: "{{ epel_repo.el7 }}"
state: present
Expand All @@ -25,35 +21,31 @@
when: ansible_distribution_major_version == '8'

- hosts: undercloud
gather_facts: yes
tasks:
- name: get floating ip of server and client
shell: |
. {{ overcloudrc }}
openstack server list | grep {{ item }} | cut -d \| -f 5 | cut -d \, -f 2 | awk '{$1=$1;print}'
register: vms_fip
with_items:
- "{{ vm_names }}"

- hosts: localhost
vars:
pbench_agent_install: true
vms_fip: "{{ hostvars['undercloud']['vms_fip'] }}"
host_file: "{{ ansible_user_dir }}/.config/hosts"
infrared_inv: "{{ ansible_user_dir }}/.infrared/.workspaces/active/hosts"

tasks:
- block:
- name: remove old epel-release
yum:
name: "{{item }}"
state: absent
become: yes
ignore_errors: yes
loop:
- epel-release
- ansible

- name: install latest epel-release
yum:
name: "{{ epel_repo.el7 }}"
state: present
become: yes

- name: install ansible 2.9
yum:
name: ansible
state: present
become: yes

when: ansible_distribution_major_version < '8'

- name: copy keys to trafficgen host
shell: |
echo '{{ trafficgen_host.ssh_pass }}' | sshpass ssh-copy-id -i ~/.ssh/id_rsa -o 'StrictHostKeyChecking no' -f {{ trafficgen_host.ssh_user }}@{{ trafficgen_host.ip }}
register: ssh_result
changed_when: false
ignore_errors: true
when: trafficgen_host is defined

- name: Install the pbench-agent roles from Galaxy
shell: |
Expand All @@ -63,34 +55,44 @@
- name: generate pbench agent playbook
template:
src: pbench_agent_install.yml.j2
dest: "{{ user_dir }}/.ansible/collections/ansible_collections/pbench/agent/roles/pbench_agent_install.yml"
dest: "{{ ansible_user_dir }}/.ansible/collections/ansible_collections/pbench/agent/roles/pbench_agent_install.yml"

- name: get computes ip
shell: |
. {{ stackrc }}
nova list | grep {{ item }} | cut -d \| -f 7 |cut -d \= -f 2 | awk '{$1=$1;print}'
register: computes_ip
with_items:
- "{{ compute_names }}"
- name: create .config dir
file:
path: "{{ ansible_user_dir }}/.config/"
state: directory

- name: get floating ip of server and client
- name: copy the infrared inv in ~/.config
shell: |
. {{ overcloudrc }}
openstack server list | grep {{ item }} | cut -d \| -f 5 | cut -d \, -f 2 | awk '{$1=$1;print}'
register: vms_fip
with_items:
cp {{ infrared_inv }} {{ host_file }}
- name: Add client and server in inventory
blockinfile:
path: "{{ host_file }}"
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item[0] }}"
regexp: "[local]"
block: |
{{ item[0] }} original_name= ansible_host={{ item[1].stdout }} ansible_connection=ssh ansible_user=root ansible_ssh_private_key_file={{ id_rsa_overcloud }} ansible_ssh_common_args='-o ProxyCommand="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -W %h:%p -i {{ ansible_user_dir }}/.ssh/id_rsa stack@{{ undercloud_hostname }}"'
with_together:
- "{{ vm_names }}"
- "{{ vms_fip.results }}"

- name: create a inventory file
template:
src: repo_bootstrap.hosts.j2
dest: "{{ user_dir }}/.config/myhosts.inv"
src: my.hosts.j2
dest: "{{ ansible_user_dir }}/.config/myhosts.inv"

- name: generate a pbench_agent_install inv
shell: |
cat "{{ ansible_user_dir }}/.config/myhosts.inv" >> {{ host_file }}
- name: run the playbook pbench_agent_install.yml
shell: |
ansible-playbook -i ~/.config/myhosts.inv pbench_agent_install.yml
export ANSIBLE_HOST_KEY_CHECKING=False
ansible-playbook -i {{ host_file }} pbench_agent_install.yml -T {{ timeout }} --user=root
register: agent_install
args:
chdir: "{{ user_dir }}/.ansible/collections/ansible_collections/pbench/agent/roles/"
chdir: "{{ ansible_user_dir }}/.ansible/collections/ansible_collections/pbench/agent/roles/"
- debug:
msg: "{{ agent_install }}"

4 changes: 2 additions & 2 deletions install/roles/images/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
# Obtain/Upload guest_images to OpenStack Cloud

- name: Fetch image
- name: Fetch image centos7
get_url:
url: "{{ guest_images[item].url_centos7 }}"
dest: "/home/stack/{{ guest_images[item].name }}.{{ guest_images[item].type }}"
with_items: "{{ guest_images }}"
when: ansible_distribution_major_version < '8'

- name: Fetch image
- name: Fetch image centos8
get_url:
url: "{{ guest_images[item].url_centos8 }}"
dest: "/home/stack/{{ guest_images[item].name }}.{{ guest_images[item].type }}"
Expand Down
25 changes: 25 additions & 0 deletions install/templates/my.hosts.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[vms]
{% for item in vm_names %}
{{ item }}
{% endfor %}

{% if trafficgen_host is defined %}
[trafficgen_host]
{{ trafficgen_host.ip }}
{% endif %}

[servers:children]
compute
vms
{% if trafficgen_host is defined %}
trafficgen_host
{% endif %}

{% if pbench_agent_install|default(false) %}
[servers:vars]
# where to get the key
pbench_key_url = {{ pbench_key_url }}

# where to get the config file
pbench_config_url = {{ pbench_config_url }}
{% endif %}
Empty file modified install/templates/pass_auth.sh.j2
100755 → 100644
Empty file.
13 changes: 4 additions & 9 deletions install/templates/repo_bootstrap.hosts.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
{{ item.stdout }}
{% endfor %}
{% endif %}
{% for item in computes_ip.results %}
{{ item.stdout }}
{% for item in computes_ip.stdout_lines%}
{{ item }}
{% endfor %}

{% if pbench_agent_install|default(false) %}
[servers:vars]
# where to get the key
pbench_key_url = {{ pbench_key_url }}

# where to get the config file
pbench_config_url = {{ pbench_config_url }}
{% if trafficgen_host is defined %}
{{ trafficgen_host.ip }}
{% endif %}

0 comments on commit 674f501

Please sign in to comment.